Closed plesiosaure closed 6 years ago
So passing the hydration mode to getResult
allows passing a custom one in the ORM but setHydrationMode
does not ? This looks weird to me.
sorry, it works with passing the key defined in the config.yml :
setHydrationMode('my_custom_hydrator')
but not if you use the entity manager as described in the doctrine doc :
$em->getConfiguration()->addCustomHydrationMode('CustomHydrator', 'MyProject\Hydrators\CustomHydrator');
//this seems to work if you dump entity manager : it is added
setHydrationMode('CustomHydrator'); // didn'twork for me
It seems that you can set HydrationMode with magical method setHydrationMode on the query before sending to Paginator (see issue #102) but not use a custom one : without pagination, you just need to pass the hydrator as a parameter of getResult()
So how to add a new field that is not provided in the raw entities datas returned by the query ?