-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Related Objects not Hydrated at all despite fetch:EAGER #11203
Comments
Loosely relates to #11185 |
If a proxy object already exists in the identity map of the ORM, you will still get it (even though it might be an initialized proxy at some point) because the identity map must only manage one object instance for each database id (by design), and it cannot replace it by a different one (as it does not have any way to replace the other references to that object in other entities already instantiated). That's why you might still get a proxy object |
@stof are you saying that if I have two |
@craigh the second fetch will indeed get the same object instance (whether it gets hydrated or no during the second fetch depends on the case). |
Bug Report
Summary
No matter how "EAGER" the query, I keep getting a proxy object.
Current behavior
I have a query like
The
record
object (obviously) has relationsIf I run the query and dump the results
The BoardMember object in each Record object is a Proxy and that Proxy has NO VALUES. Additionally, the proxy doesn't fetch the values when they are called. The values are all simply
unset
.I am using this via Symfony 6.4.3 and I have configured Symfony doctrine/doctrine-bundle 2.11.1 like so:
I also tried
in the query, but that made no change.
I also tried
instead of
getResult
and the arrays are fully hydrated correctly but I would prefer the objects...This worked previously, with Symfony 5 ( I know you're not Symfony) but the
enable_lazy_ghost_objects
value changed for that fromfalse
totrue
so may be related. Changing this back tofalse
does seem to fix my problem (Object is still a proxy but has needed values in it). But then I have the depreciation warnings again. So I'd like to fix the other problem...Expected behavior
I expect the object to by fully hydrated since the
fetch:EAGER
property is set. I would also expect the Proxy to fetch the value if I called it.The text was updated successfully, but these errors were encountered: