DDC-2762: [GH-829] [DDC-2761] Fixed UnitOfWork::recomputeSingleEntityChangeSet exception with STATE_REMOVED entities #3456

Closed
opened 2026-01-22 14:20:12 +01:00 by admin · 5 comments
Owner

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 :)

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 :)
admin added the Bug label 2026-01-22 14:20:12 +01:00
admin closed this issue 2026-01-22 14:20:12 +01:00
Author
Owner

@doctrinebot commented on GitHub (Oct 25, 2013):

Comment created by giosh94mhz:

The DoctrineBot didn't read "[DDC-2761]" in the title of the pull request, so it has opened a new bug. The test class now refers to DDC-2761 as ticket number, and there is a duplicate ticket.

Sorry for the extra work guys, but I've opened a github account just to send you this patch! :-) Next time I'll RTFM, promise!

@doctrinebot commented on GitHub (Oct 25, 2013): Comment created by giosh94mhz: The DoctrineBot didn't read "[[DDC-2761](http://www.doctrine-project.org/jira/browse/DDC-2761)]" in the title of the pull request, so it has opened a new bug. The test class now refers to [DDC-2761](http://www.doctrine-project.org/jira/browse/DDC-2761) as ticket number, and there is a duplicate ticket. Sorry for the extra work guys, but I've opened a github account just to send you this patch! :-) Next time I'll RTFM, promise!
Author
Owner

@doctrinebot commented on GitHub (Jan 2, 2014):

Comment created by @doctrinebot:

A related Github Pull-Request [GH-845] was closed:
https://github.com/doctrine/doctrine2/pull/845

@doctrinebot commented on GitHub (Jan 2, 2014): Comment created by @doctrinebot: A related Github Pull-Request [GH-845] was closed: https://github.com/doctrine/doctrine2/pull/845
Author
Owner

@doctrinebot commented on GitHub (Jan 2, 2014):

Comment created by @doctrinebot:

A related Github Pull-Request [GH-829] was closed:
https://github.com/doctrine/doctrine2/pull/829

@doctrinebot commented on GitHub (Jan 2, 2014): Comment created by @doctrinebot: A related Github Pull-Request [GH-829] was closed: https://github.com/doctrine/doctrine2/pull/829
Author
Owner

@doctrinebot commented on GitHub (Jan 2, 2014):

Comment created by @beberlei:

This was fixed with DDC-2790

@doctrinebot commented on GitHub (Jan 2, 2014): Comment created by @beberlei: This was fixed with [DDC-2790](http://www.doctrine-project.org/jira/browse/DDC-2790)
Author
Owner

@doctrinebot commented on GitHub (Jan 2, 2014):

Issue was closed with resolution "Duplicate"

@doctrinebot commented on GitHub (Jan 2, 2014): Issue was closed with resolution "Duplicate"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#3456