[PR #9955] fix: disabling versioning #12001

Closed
opened 2026-01-22 16:12:36 +01:00 by admin · 0 comments
Owner

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

State: closed
Merged: No


When ClassMetadataInfo has the version field information (versioning), ->setVersioned(false) will set the requiresFetchAfterChange flag to invalid if "generated" fields are not mapped. This PR fixes setting the flag state.

The consequence of the invalid state of requiresFetchAfterChange is the generation of invalid queries by the BasicEntityPersister::fetchVersionAndNotUpsertableValues method during the INSERT and UPDATE operations.

In this PR, I added two tests that verify the state after the setVersioned(false) operation is performed.

Why
setVersioned(...) is public and not restricted (by comments or doc) method. It is possible to call setVersioned(false) after setVersionMapping(...) which will produce invalid state. In some cases we need to overwrite state to achieve business feature f.e. to disable version verification during flush() in app with annotated entities with @Version.

**Original Pull Request:** https://github.com/doctrine/orm/pull/9955 **State:** closed **Merged:** No --- When ClassMetadataInfo has the version field information (versioning), `->setVersioned(false)` will set the `requiresFetchAfterChange` flag to invalid if "generated" fields are not mapped. This PR fixes setting the flag state. The consequence of the invalid state of `requiresFetchAfterChange` is the generation of invalid queries by the BasicEntityPersister::fetchVersionAndNotUpsertableValues method during the INSERT and UPDATE operations. In this PR, I added two tests that verify the state after the `setVersioned(false)` operation is performed. **Why** `setVersioned(...)` is public and not restricted (by comments or doc) method. It is possible to call `setVersioned(false)` after `setVersionMapping(...)` which will produce invalid state. In some cases we need to overwrite state to achieve business feature f.e. to disable version verification during flush() in app with annotated entities with @Version.
admin added the pull-request label 2026-01-22 16:12:36 +01:00
admin closed this issue 2026-01-22 16:12:36 +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#12001