[PR #828] Fixed UnitOfWork::recomputeSingleEntityChangeSet exception with STATE_REMOVED entities #8769

Open
opened 2026-01-22 16:01:38 +01:00 by admin · 0 comments
Owner

Original Pull Request: https://github.com/doctrine/orm/pull/828

State: closed
Merged: No


Hi!

I found a bug in UnitOfWork::recomputeSingleEntityChangeSet for the branch 2.4. I didn't tested master and previous version, 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. I think also that an entity in STATE_REMOVED don't need to be updated, and should be immediately deleted. If you agree, I could implement it myself (as long I manage not to break unit tests).

**Original Pull Request:** https://github.com/doctrine/orm/pull/828 **State:** closed **Merged:** No --- Hi! I found a bug in UnitOfWork::recomputeSingleEntityChangeSet for the branch 2.4. I didn't tested master and previous version, 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. I think also that an entity in STATE_REMOVED don't need to be updated, and should be immediately deleted. If you agree, I could implement it myself (as long I manage not to break unit tests).
admin added the pull-request label 2026-01-22 16:01:38 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#8769