mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-2762: [GH-829] [DDC-2761] Fixed UnitOfWork::recomputeSingleEntityChangeSet exception with STATE_REMOVED entities #3453
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 25, 2013).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user @doctrinebot:
This issue is created automatically through a Github pull request on behalf of giosh94mhz:
Url: https://github.com/doctrine/doctrine2/pull/829
Message:
Hi!
I found a bug in UnitOfWork::recomputeSingleEntityChangeSet for the branch 2.4, which is also present in master. I didn't tested previous stable versions, but the bug may also apply.
The problem is that an exception is thrown on flush (at least when using a single entity flush), if an entity is in deleted state and also with pending modification and a preUpdate listener configured.
I've attached a patch and a unit tests (I've tweeked a previous preUpdate method used for testing, but everythings pass).
Anyway, this result in an UPDATE followed by a DELETE statement. An entity in STATE_REMOVED shouldn't need to be updated, and should be immediately deleted. If you agree, I could implement this behaviour myself (as long I manage not to break unit tests).
PS: sorry for the commit on the 2.4 branch :)