mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Understanding Partial object hydration #6822
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 @flaushi on GitHub (Sep 8, 2021).
Bug Report
Summary
I query all objects of one type partially to have them in the UoW. Although I do not mention some self-referencing ManyToOne associations in this query, they still are hydrated and point to their partial siblings. That would be fine for me. However some (speaking of 200.000 out of 900.000) get hydrated fully (with extra queries) and I have to find out why.
Current behavior
20% of the entities in the UoW are hydrated fully
How to reproduce
My class:
My query that should just fill the UoW: (not it does not query the association, but still these associations are present in the objects finally)
This test should return the number zero
but there are over 200.000 out of 900.000 total array elements which are fully hydrated. Could it be that the association gets hydrated fully if the loop that hydrates all queries has not reached the linked object? Can I somehow circumvent that?
I simplified one detail here, i.e.
DataCategoryis an abstract class in reality, and I query all child classes.You would help me greatly if you could point me the the code that does the partial hydration and especially the associations.
Expected behavior
All object shoudl be in the UoW partially, i.e.
description === ''@beberlei commented on GitHub (Sep 8, 2021):
Partial objects are deprecated and will be removed in 3.0
The partiallity mostly refers to simple fields not to associations.