Doctrine collections as value objects

I work with a DDD symfony application with a Rest API.

We have many doctrine collection per entity, and I have 2 problems.

  • The merge of actual collections and the new one received by the API is huge and I can’t find a easy way to do that
  • is it better to use value object array instead of doctrine collections in the domain?

Collections are beautiful but it’s never a immutable state. Entities can be lazy fetched, proxified etc.. But in the other case ->to Array() will fetch all concerned entities right? So a performance issue can be reached?

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *