I’m using doctrine query to receive a single instance of a domain object:
$entity = $query->getSingleResult();
Now I would like to hydrate $entity AFTER I received it already, so that $entity is an array (like when receiving it using \Doctrine\ORM\Query::HYDRATE_ARRAY).
I’m looking for something like this:
$doctrine->hydrate($entity, \Doctrine\ORM\Query::HYDRATE_ARRAY);
Is there way to achieve this using Doctrine?
I was looking for the same thing, but haven’t found it.
There are some infinite recursion problems with serializing entities because of circular referencing.
In the end, I rolled my own serialize function based on this example