mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
EAGER loading an Association Mapped IDs #6038
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.
@Ocramius commented on GitHub (Aug 15, 2018):
Please upgrade your ORM version first, then report the issue again if it still occurs.
@mattsah commented on GitHub (Aug 15, 2018):
ORM version is determined by composer, based on requirements for laravel-doctrine/orm as well as the version of PHP which our servers will have available. Newer versions of doctrine require versions which are unavailable on our servers.
To be clear, what is the minimum version of doctrine ORM which is supported for PHP 7.0? Is there any?
@Ocramius commented on GitHub (Aug 15, 2018):
No, the current active releases require PHP 7.1+