-
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
Fixed array hydration #9186
base: 2.10.x
Are you sure you want to change the base?
Fixed array hydration #9186
Conversation
Resetting `$this->_identifierMap` of base element children each time the new to-many relation is added to base element fixes doctrine#9185
c8e6160
to
e54dbd9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@greg0ire please review.. looks good to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 questions:
- Why does this fix the bug? I understand what the bug is (great explanation BTW), but I don't understand why it happens.
- Is this going to have consequences in terms of performance? I think the hydration is in the hot path of
doctrine/orm
, and I think resetting an array means loosing data. We have a benchmark to test that kind of thing: https://github.com/doctrine/orm/blob/2.10.x/tests/Doctrine/Performance/Hydration/SimpleQueryArrayHydrationPerformanceBench.php
So far, everything works as expected, but then comes 'Article 2' phone numbers in different order than before. If
Two array elements with different keys, but same values. That will cause unexpected behavior in
Because of that, on
|
Also, while trying to explain this bug right now, I noticed another problem. If you changed the order of article rows in my test case (order by ids: 1, 2, 1, 2), results would be interesting, too. |
Thanks for your explanation! I can't say it helps me because I too am not very familiar with that part of the code, but I will try to get the right people to review this. |
Does ObjectHydrator have similar code to handle this already? I find it strange this never came up before. I am confused why its nested, since you dont fetch the object but properties. Can you turn this into a real DQL query as per your comment? I am wondering if the problem is just a wong ResultSetMapping |
Yeah, query didn't correspond to what I was trying to accomplish. I updated it, I want nested results. |
Is anybody looking at this issue? I don't want it to be forgotten. |
There hasn't been any activity on this pull request in the past 90 days, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days. |
Resetting
$this->_identifierMap
of base element children each time the new to-many relation is added to base element.Includes a was-failing-but-now-passing test case.
fixes #9185