Description
Hi, I am having an issue with a geometry collection field . At some point, I have to update the field removing all points inside it. The problem is when I try to obtain an object from the DB and then get the field as an array.
It seems that the cast for an empty geometry collection is erroneous:
FatalThrowableError (E_ERROR) Call to a member function toArray() on string
The error occurs when calling:
$obj->waypoints->toArray()
A dump for the object returns the field as:
"waypoints" => "\x00\x00\x00\x00\x01\x07\x00\x00\x00\x00\x00\x00\x00"
The SQL query for the field, using ST_AsText(waypoints) returns:
GEOMETRYCOLLECTION()
I declare the field in the migration as:
$table->geometryCollection('waypoints');
and declare as a spatial field on the model class:
protected $spatialFields = [ 'waypoints' ];