Open peirix opened 1 year ago
It looks like your Order record has one or more Meta entries where the type field is undefined/null
. You might want to check what meta rows you have in the database for that entity. Did you instantiate any of the meta values directly (as opposed to setMeta() which will always set the type field) or perform any manual data manipulations on the database? What is the value field of that meta entry?
Hi. We're using syncMeta()
to set the fields from a users meta to the orders meta:
$order->syncMeta(array_merge(
$request->user()->account->only(['invoice_email']),
$request->user()->account->getAllMeta()->only([
'invoice_name',
'invoice_org',
'invoice_address',
'invoice_zip',
'invoice_city',
'shipping_same_as_invoice',
'shipping_name',
'shipping_address',
'shipping_zip',
'shipping_city',
])->toArray()
));
And the database looks to be correct:
I see now that there are some fields missing there (the shipping fields) for some reason. I'll have to look into why, but would that cause an issue that they're not there? It should just return all available meta fields anyway, right?
AFK, but is it possible that the only() method is returning empty keys for ones that don't exist? Probably some tuning that could be done to the package to better handle that scenario, but you might be able to work around it by using array_filter before syncing
But still not sure why I'm getting an error on empty types based on the information that is in the database now?
I tried manually adding the missing fields to the meta
table, but that didn't change anything. I see that some of my orders don't give this error message, and those orders have all the fields set in the meta
table. So it seems to be related to that somehow.
I get an error when trying to fetch all meta belonging to an object:
Plank\Metable\DataType\Registry::getHandlerForType(): Argument #1 ($type) must be of type string, null given, called in /var/www/html/vendor/plank/laravel-metable/src/Meta.php on line 76
I have the full error stack here: https://flareapp.io/share/oPRq3OAm#F63
Running: