cwsdigital/twill-metadata

TypeError Illuminate\Database\Grammar::parameterize()

Closed this issue · 2 comments

I am having some issues using the trait whenever I try to create a model that has the trait I get the following error:

TypeError Illuminate\Database\Grammar::parameterize(): Argument #1 ($values) must be of type array, string given, called in vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/Grammar.php on line 1022.

if I remove the trait I can create the model without any issues;

Laravel 9.38.0
Twill 2.10.0
twill-metadata 1.2.2

@futurewebsites are you referring to the HasMetadata trait used in the Model? Are you trying to override any default fallbacks within the model?

@futurewebsites not sure if you have been able to get a work around for this but I think your issue could be linked to the $mediasParams not being set in your model (probably because you don't any other media requirements for the model) and so when the HasMetadata is initialised the $mediasParams acts like an attribute on the Model messing up the initial create save flow.

You could try something like

class Page extends Model
{
...
public $mediasParams = [];
...
}