Hydrating Doctrine's relationships with Hal

Hello everyone!!!

Expressive + Doctrine.

I have an entity(UserEntity) which has an attribute called knowledges(KnowledgeEntity). Logically an user will be able to have a lot of knowledges therefore the relationship is 1 to N.

I am using ZF Hal to return the data.

All attributes are returned correctly, but knowledges is returned as an empty json.

{
Id: 1,
Name: “Michael”,
Contact: {
Id: 1,
Phone: “12345678”
}
Knowledges: {}
}

Knowledges attribute of user’s class is an ArrayCollection.

¿How can I fix this bug?

I’d like to understand better its behavior.

Thanks you very much :grinning:

-redacted due to needless attack-

Use a CollectionExtract hydrator strategy. Example here: https://github.com/api-skeletons/zf-doctrine-hydrator