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