[PR #10806] Fix enum change set recomputation on single entity #12634

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

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

State: closed
Merged: Yes


The root cause is well explained in #10074 and #10277
These PRs mitigate the issue in computeChangeSet method, but in some cases recomputeSingleEntityChangeSet might also be called.
One of the cases where recomputeSingleEntityChangeSet might be called are in event listeners when you want to modify some other existing entity. Due to the fact that originalEntityData contains enum objects and ReflectionEnumProperty::getValue() returns value of enum - comparison of values are always falsy, resulting to update column value even though its exactly the same. In case nothing changed in entity it can even result to additional queries to DB if entity contains enum attribute

**Original Pull Request:** https://github.com/doctrine/orm/pull/10806 **State:** closed **Merged:** Yes --- The root cause is well explained in #10074 and #10277 These PRs mitigate the issue in `computeChangeSet` method, but in some cases `recomputeSingleEntityChangeSet` might also be called. One of the cases where `recomputeSingleEntityChangeSet` might be called are in event listeners when you want to modify some other existing entity. Due to the fact that `originalEntityData` contains enum objects and `ReflectionEnumProperty::getValue()` returns value of enum - comparison of values are always falsy, resulting to update column value even though its exactly the same. In case nothing changed in entity it can even result to additional queries to DB if entity contains enum attribute
admin added the pull-request label 2026-01-22 16:14:41 +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#12634