Hydrating and using ZF2 aggregate hydrator

164 Views Asked by At

Is using an aggregate hydrator appropriate for this situation? If so how would I go about hydrating these entities, I found the documentation confusing & can't really find any examples online.

I have two entities with a many-to-many relationship. Some properties on one of the entities are dependant on the relationship.

Example

Here are two entities with a many-to-many relationship, which is maintained using a relationship table in the database. The size property on the question object is dependant on which application the relationship.

diagram

The database is laid out like this. diagram

So the idea is that each application can have multiple questions & the size of each question can be set individually for each application.

My understanding of the aggregate hydrator is that I have a normal hydrator to hydrate both application and question entities initially, then the aggregate would hydrate a final application entity using the two entities it previously hydrated. Is that correct, I could be very wrong.

Is it possible to hydrate objects like this without an aggregate hydrator, what is the best way to do this?

0

There are 0 best solutions below