Closed f-liva closed 3 years ago
Feel free to submit a PR with tests that fixes this.
When a schemaless column from db is set to NULL instead of
{}
, on scout:import it results in that error:Return value of Spatie\SchemalessAttributes\SchemalessAttributes::getRawSchemalessAttributes() must be of the type array, string returned
Isn't this expected behaviour though? Your database value is most likely set to NULL as a string. Can you confirm for this? 🤔
I've tried to reproduce the issue with a NULL value and it was working properly. The only way I managed was to set NULL as a string.
I have the same problem at PHP v7.2.14
Yes this issue is back because the function is type hinted to an array,
protected function getRawSchemalessAttributes(): array
but it calls the return function fromJson which returns a mixed type.
This problem appears to be an issue still, particularly for those of us using Postgres when you have a null object, ie {}::json.
move to close: has this been resolved by #60 ? (came here via good first issue)
move to close: has this been resolved by #60 ? (came here via good first issue)
X2
When a schemaless column from db is set to NULL instead of
{}
, on scout:import it results in that error:Return value of Spatie\SchemalessAttributes\SchemalessAttributes::getRawSchemalessAttributes() must be of the type array, string returned