mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
[PR #829] [CLOSED] [DDC-2761] Fixed UnitOfWork::recomputeSingleEntityChangeSet exception with STATE_REMOVED entities #8766
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?
📋 Pull Request Information
Original PR: https://github.com/doctrine/orm/pull/829
Author: @giosh94mhz
Created: 10/25/2013
Status: ❌ Closed
Base:
master← Head:master📝 Commits (2)
eeadc3eFixed UnitOfWork::recomputeSingleEntityChangeSet exception with STATE_REMOVED entities9a9f7dfUse strict comparison in recomputeSingleEntityChangeSet📊 Changes
2 files changed (+32 additions, -5 deletions)
View changed files
📝
lib/Doctrine/ORM/UnitOfWork.php(+1 -1)📝
tests/Doctrine/Tests/ORM/Functional/LifecycleCallbackTest.php(+31 -4)📄 Description
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 :)
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.