mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
[PR #12335] [MERGED] Avoid lazy object initialization when initializing read-only property #13701
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/12335
Author: @greg0ire
Created: 1/6/2026
Status: ✅ Merged
Merged: 1/9/2026
Merged by: @greg0ire
Base:
3.6.x← Head:gh-12166📝 Commits (1)
e923bbcAvoid lazy object initialization when initializing read-only property📊 Changes
3 files changed (+83 additions, -1 deletions)
View changed files
📝
src/Mapping/PropertyAccessors/ReadonlyAccessor.php(+8 -1)➕
tests/Tests/ORM/Functional/Ticket/GH12166/GH12166Test.php(+32 -0)➕
tests/Tests/ORM/Functional/Ticket/GH12166/LazyEntityWithReadonlyId.php(+43 -0)📄 Description
Initializing e.g. a readonly ID does not require loading any data from
the database. However, calling isInitialized() on the reflection of a
readonly property triggers the native lazy object initialization.
If we have a lazy property at hand, then the property cannot be initialized
already, so it is safe to skip the call.
Fixes #12166
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.