I have this code:
public function toSearchableArray()
{
    $data = $this->toArray();
    $data['_geoloc'] = $this->_geoloc->toArray();
    $data['address'] = $this->address->toArray();
    return $data;
}
However sometimes $data['entities'] is null therefore throwing me an error:
 [Symfony\Component\Debug\Exception\FatalThrowableError]
  Call to a member function toArray() on null
Is there any way to by-pass that?
via Chebli Mohamed
 
Aucun commentaire:
Enregistrer un commentaire