mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
[PR #11601] EntityManager::getReference() should handle a PK which is also a FK #13124
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?
Original Pull Request: https://github.com/doctrine/orm/pull/11601
State: closed
Merged: No
EntityManager::getReference()should be able to handle a PK which is also a FK, just the way::find()already does.Current behaviour:
With this PR, the proxy factory would hydrate the proxy with a reference to the related entity if a relation is detected (addressing case 1 above)
Additionally
EntityManager::getReference()would use the same approach as infind()and attempt to extract the underlying PK value when passed an entity (case 2).In this first attempt, I just copy/pasted some code from
find()togetReference(). These two have a lot in common, if this proposed change is of any interest I will improve it and deduplicate this code in a second version.P.S. I believe this (somewhat related) issue #5640 may be closed.