[2.17.x,2.18.x] Failed getting entity with fetch eager property #7262

Closed
opened 2026-01-22 15:48:31 +01:00 by admin · 4 comments
Owner

Originally created by @dbannik on GitHub (Nov 28, 2023).

Bug Report

Q A
BC Break yes
Version 2.17.x, 2.18.x

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

Originally created by @dbannik on GitHub (Nov 28, 2023). ### Bug Report <!-- Fill in the relevant information below to help triage your issue. --> | Q | A |------------ | ------ | BC Break | yes | Version | 2.17.x, 2.18.x #### 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
admin added the BugBC Break labels 2026-01-22 15:48:31 +01:00
admin closed this issue 2026-01-22 15:48:31 +01:00
Author
Owner

@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 76fd34f766

I 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.

@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 https://github.com/doctrine/orm/commit/76fd34f76607b1b96f381377c1c51df292c759aa I 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.
Author
Owner

@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.

@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.
Author
Owner

@michnovka commented on GitHub (Mar 17, 2024):

@greg0ire which PR closed this?

@michnovka commented on GitHub (Mar 17, 2024): @greg0ire which PR closed this?
Author
Owner

@greg0ire commented on GitHub (Mar 17, 2024):

This one I think: https://github.com/doctrine/orm/pull/11090

@greg0ire commented on GitHub (Mar 17, 2024): This one I think: https://github.com/doctrine/orm/pull/11090
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#7262