mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
[PR #12229] Reorganize read-only class check in UnitOfWork #13600
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/doctrine/orm/pull/12229
Author: @rvanlaak
Created: 10/20/2025
Status: 🔄 Open
Base:
2.20.x← Head:patch-1📝 Commits (3)
403fb38Reorganize read-only class check in UnitOfWork0edc467Add test on what to expect6da8329cs📊 Changes
2 files changed (+33 additions, -6 deletions)
View changed files
📝
src/UnitOfWork.php(+9 -5)📝
tests/Tests/ORM/UnitOfWorkTest.php(+24 -1)📄 Description
Right now, calling
computeChangeSetsand thereafter trying to rely onisReadOnlydoes not work as expected. The state ofreadOnlyObjectsinternally did not sufficiently get updated. Thereby public methodisReadOnlyis not as reliable as expected.This PR moves the check for read-only classes to a different location in the code to improve reliability of
isReadOnly.Taking the metadata to userland in order to check for a class to be readonly is not preferable, especially as
computeChangeSetsalready is iterating over the metadata and entity objects.Expected behavior
Being able to reliably use
isReadOnlyto throw an exception in userland when a write to an entity is expected while these values won't be committed / flushed by the orm.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.