mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
[2.17.x,2.18.x] Failed getting entity with fetch eager property #7262
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 @dbannik on GitHub (Nov 28, 2023).
Bug Report
Summary
There is such a structure:
AbstractRemoveControl
MobileRemoteControl
User
Relationships:
User ---ManyToOne---> AbstractRemoteControl
AbstractRemoteControl ---OneToMany(fetch=Eager)---> Collection<User>
When querying from the database for User:
2.17.x - (Undefined array key "id" | TypeError : ReflectionProperty::getValue(): Argument 1 ($object) must be provided for instance properties)
2.16.x - Ok
How to reproduce
FunctionalTests https://github.com/doctrine/orm/pull/11090 #11262
@michnovka commented on GitHub (Jan 18, 2024):
It seems we have a loop where while User is being hydrated, in the middle of it AbstractRemoteControl is being hydrated, and this due to eager fetching of User entity, tries to hydrate User entity again (before the original hydration is completed). However the User entity is hydrated at this point with remote_control pointing to null (because hydration was not finished)
This all seems to be introduced due to the changes here
76fd34f766I spent some time debugging it, but I am not so familiar with the details and circumstances why the lazy loading of collections was changed, the removal (or even meaning) of SUBSELECT, so I cannot fix this.
@ghost commented on GitHub (Mar 15, 2024):
Has anyone found a workaround?
I'd like to allow my team to upgrade doctrine/orm passed 2.16.3, but beginning with 2.17.0 all our relationships whose inverse side has
fetch: 'EAGER'cause the TypeError.@michnovka commented on GitHub (Mar 17, 2024):
@greg0ire which PR closed this?
@greg0ire commented on GitHub (Mar 17, 2024):
This one I think: https://github.com/doctrine/orm/pull/11090