[PR #829] [CLOSED] [DDC-2761] Fixed UnitOfWork::recomputeSingleEntityChangeSet exception with STATE_REMOVED entities #8766

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

📋 Pull Request Information

Original PR: https://github.com/doctrine/orm/pull/829
Author: @giosh94mhz
Created: 10/25/2013
Status: Closed

Base: masterHead: master


📝 Commits (2)

  • eeadc3e Fixed UnitOfWork::recomputeSingleEntityChangeSet exception with STATE_REMOVED entities
  • 9a9f7df Use 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.

## 📋 Pull Request Information **Original PR:** https://github.com/doctrine/orm/pull/829 **Author:** [@giosh94mhz](https://github.com/giosh94mhz) **Created:** 10/25/2013 **Status:** ❌ Closed **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (2) - [`eeadc3e`](https://github.com/doctrine/orm/commit/eeadc3e205063655e23431c75997a6caf4ae0a84) Fixed UnitOfWork::recomputeSingleEntityChangeSet exception with STATE_REMOVED entities - [`9a9f7df`](https://github.com/doctrine/orm/commit/9a9f7df1d7f2e26aea44a38f9f97514cf66e1318) Use strict comparison in recomputeSingleEntityChangeSet ### 📊 Changes **2 files changed** (+32 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `lib/Doctrine/ORM/UnitOfWork.php` (+1 -1) 📝 `tests/Doctrine/Tests/ORM/Functional/LifecycleCallbackTest.php` (+31 -4) </details> ### 📄 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 :) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
admin added the pull-request label 2026-01-22 16:01:37 +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#8766