mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-1276: Merging persistent collections broken if managed and merged collection are the same object #1605
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Jul 13, 2011).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user liwo:
When FLOW3 maps request arguments to entities, it works on clones of the changed entities while entities, which are not affected by the request arguments stay the original objects. If the entity has a persistent collection which is not changed and therefore not cloned, the call to $repository->update() (which internally calls $em->merge()) eventually clears the $managedCol in $uow->doMerge() (line 1460 in current master), but if the $mergeCol is the same object, this is obviously wrong behavior as no related entities exist anymore in the entity to merge.
Made up example code (not sure if this simple example works as I have no test setup I could use for it)
After this relation of $b is empty
@doctrinebot commented on GitHub (Jul 26, 2011):
Comment created by @beberlei:
Fixed
@doctrinebot commented on GitHub (Jul 26, 2011):
Issue was closed with resolution "Fixed"