mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
EAGER loading an Association Mapped IDs #6036
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?
Originally created by @mattsah on GitHub (Aug 14, 2018).
Originally assigned to: @Ocramius on GitHub.
Bug Report
Summary
When trying to fetch an associated entity using EAGER, association mapped IDs seem to fail with
spl_object_hash() requires parameter 1 to be an object.Current behavior
I have an entity id which is an association key, see config below. I'd like to perform an
EAGERfetch on the related person on this entity, however, when I do an eager fetch any attempt toProviders::find()(a standard Doctrinefind()on a repository) fails withspl_object_hash() requires parameter 1 to be an object.Keepingfetch: LAZYresolves this.I traced this down to ~lines 998 - 1005 (in this version) of the
BasicEntityPersister:$sourceEntityappears to be the provider,$fieldispersonwhich is, and indeed, when fetching EAGER, it appears the person value at that point isNULL-- not clear why.How to reproduce
Create an associated entity whose id is an association key.:
Attempt to find using the related entity:
Expected behavior
I would expect how the associated entity is fetched not to affect my ability to find its related entity based on it.