[DDC-22] EntityManager#refresh() should also refresh associations. Created: 25/Sep/09 Updated: 28/Oct/09 Resolved: 28/Oct/09
|Project:||Doctrine 2 - ORM|
|Reporter:||Roman S. Borschel||Assignee:||Roman S. Borschel|
1) For the state of the entity that is refreshed itself this is self-explanatory (simple select on the primary table, this is what already works).
2) For single-valued associations the proper query depends on whether the entity being refreshed represents the owning side or the inverse side of the association. If it is the inverse side, a simple query like this should do:
If it is the owning side, a join may be required:
3) For one-to-many collections, a simple select on the target entity table, similar to the following should do:
For many-to-many collections a similar select that joins over the join table is required.
An clever way for collections might be to not trigger this SQL immediately on refresh() but to simply mark the collection as uninitialized again so that the first access would trigger the reload, similar to a lazy-load.
Note that the collection itself is refreshed, not the state of the entities contained therein.