Skip to content

fix creating product options in hub#1394

Merged
alecritson merged 1 commit intolunarphp:0.7from
dystcz:hotfix/creating-product-options-in-hub
Dec 20, 2023
Merged

fix creating product options in hub#1394
alecritson merged 1 commit intolunarphp:0.7from
dystcz:hotfix/creating-product-options-in-hub

Conversation

@dominik-wbz
Copy link
Contributor

Addressing #1356

After commit c456c78 creating product option in hub throws error

Lunar\Models\ProductOptionValue::getNameAttribute(): Argument #1 ($value) must be of type string, null given, called in /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php on line 658

Added test for creating a product option and in ProductOption.php, the function getNameAttribute now accepts null value as an argument to avoid the error.

@vercel
Copy link

vercel bot commented Dec 19, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lunar-docs ❌ Failed (Inspect) Dec 19, 2023 6:46pm

@lguichard
Copy link
Contributor

@dominik-wbz

You can also change in ProductOptionValue class & tests :

class ProductOptionValue extends BaseModel implements SpatieHasMedia
...
    public function getNameAttribute(string $value = null): mixed
    {
        return json_decode($value);
    }

@alecritson alecritson merged commit fa8fcaf into lunarphp:0.7 Dec 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ProductOptionValue model - getNameAttribute type error

4 participants