mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-3926: orphanRemovals remove entities w/o persist/flush #4801
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 (Oct 1, 2015).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user po_taka:
Example:
Car entity:
Example code:
Bug: $leftDoor is removed from the DB, but $car1 is not persisted.
The problem is that when element is removed from PersistentCollection , then
is called.
This add deletedEntity to UnitOfWork->orphanRemovals, this is ok.
But when any entity is flushed, uow use the same UnitOfWork->orphanRemovals to remove orphans. This could delete non-persisted entities like $car1.
@see
Unit of work problematic part: https://github.com/doctrine/doctrine2/blob/2.4/lib/Doctrine/ORM/UnitOfWork.php#L318
@see
stackoverflow similar problem: http://stackoverflow.com/questions/16575114/doctrine-2-entities-relations-remove/28405843#28405843
sry for bad English :/
@doctrinebot commented on GitHub (Oct 30, 2015):
Comment created by po_taka: