In Apigility it's possible to set a Hydrator
for every Entity
-- either over the Apigility UI
or directly in the module.config.php
, e.g.:
return array(
...
'zf-hal' => array(
'metadata_map' => array(
'Portfolio\\V2\\Rest\\Project\\ProjectEntity' => array(
'entity_identifier_name' => 'id',
'route_name' => 'portfolio.rest.project',
'route_identifier_name' => 'id',
'hydrator' => 'Zend\\Stdlib\\Hydrator\\ObjectProperty',
// 'hydrator' => 'MyNamespace\\Hydrator\\ProjectHydrator',
),
...
),
...
),
...
);
See also the documentation.
Currently I'm using the ClassMethods
hydrator for all my entities.
Now I tried to change the setting to a custom hydrator. I've also tried another Zend hydrator. But whatever I do, only the hydrated I have defined in the `module.config.php is ignored.
EDIT: It works for sigle entities, but not for collections. I've checked this with the debugger and see: when I retieve a collection, my custom hydrator doesn't get called. I cannot find out, which hydrator is actually being used -- I set breakpoints and even wrote die()
s in the extract()
and hydrate()
methods of all hydrators (ArraySerializable
, ClassMethods
, ObjectProperty
, Reflection
, and also in my custom ProjectHydrator
), but the application didn't notice that at all and is still working. Seems so, that no hydration is made at all...
What is wrong here and how to get hydration settings working correctly?