Skip to content

Fix false positive changes for generated columns by updating snapshop#12384

Open
podoko wants to merge 2 commits intodoctrine:3.6.xfrom
podoko:fix-GH12017-update-snapshot
Open

Fix false positive changes for generated columns by updating snapshop#12384
podoko wants to merge 2 commits intodoctrine:3.6.xfrom
podoko:fix-GH12017-update-snapshot

Conversation

@podoko
Copy link

@podoko podoko commented Mar 1, 2026

After persisting or updating an entity having columns with the configuration generate: 'ALWAYS', the persister was updating the data on the entity but not notifying the UnitOfWork. This led the entity to be considered dirty in subsequent flushes, triggering lifecycle events. This was especially noticeable when the database field was mapped to a DateTime

This PR makes the persister update the UnitOfWork with the new values from the database. By doing this, UnitOfWork::computeChangeSet does not consider these fields as different from the ones in the database.

Note that if the user does something like $entity->nonUpdatableField = 'new value', the unit of work will again consider the entity as dirty and the field appear in the changeSet. This problem is addressed in #12385

Fixes #12017

@podoko podoko force-pushed the fix-GH12017-update-snapshot branch from a3b2e05 to 6901634 Compare March 2, 2026 22:51
@podoko
Copy link
Author

podoko commented Mar 2, 2026

I upgraded the tests in order for them to run with dbal 3.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generated columns with insertable/updatable=false cause false positive change detection

1 participant