-
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
Eagerly loaded indexed associations use hydrated values instead of database values #11185
Conversation
In order to load collections in a same way as other spots, I've chosen to reuse the existing method |
tests/Doctrine/Tests/ORM/Functional/Ticket/GH11149/GH11149Test.php
Outdated
Show resolved
Hide resolved
In case you want to run stuff locally, you can take a look at this guide. |
That's the fun part; it works on my machine, and the reason why the test EagerFetchCollectionTest has been altered. Apparently the values between my machine (PHP 8.3) and the failing GitHub actions (PHP 7.2) differ, which isn't weird considering that the eager fetch logic has been altered. Guess the next step is to have a good look at whether EagerFetchCollectionTest is still valid. |
Forcing a run on PHP 7.2.34 with the same settings as the failing GitHub action (link), still passes the tests.
I'm a bit clueless as to what is causing the difference in behavior. I have chosen to disable parts of the broken tests, that way we can see if it is the only class to fail and narrow down the search. |
@wmouwen I just had a hunch that your issue was caused by the second level cache. If you look more closely at the failing action in your link above, you will notice that there's a successful "Run PHPUnit" step, followed by a failing "Run PHPUnit with Second Level Cache". You should be able to reproduce the issue with |
@greg0ire I'm failing to find a way to get the raw database values of the correct Secondly, #11163 has been created for a different problem caused by the same PR #8391. As #8391 was an optimization, I would suggest reverting #8391 for now until a new optimization can be written without breaking changes. cc @beberlei |
667b33f
to
3cf2d72
Compare
Updated the test for |
@mpdude , maybe you can help with this? |
The below code fetches entities for associations of multiple entities at once. Line 2659 in b187bc8
We can't inject an 'indexBy' property here. Even if we could, the result would be ambiguous, as what is unique for one entity does not have to be unique across multiple entities. The Lines 2672 to 2674 in b187bc8
The column There is no clear way to combine |
…dexBy assocations.
Superseded by #11380 |
…dexBy assocations.
* 2.19.x: Remove unused variable (doctrine#11391) [Documentation] Removing "Doctrine Mapping Types" ... (doctrine#11384) [doctrineGH-11185] Bugfix: do not use collection batch loading for indexBy assocations. (doctrine#11380) Improve lazy ghost performance by avoiding self-referencing closure. (doctrine#11376)
* 2.19.x: Add missing import Remove unused variable (doctrine#11391) [Documentation] Removing "Doctrine Mapping Types" ... (doctrine#11384) [doctrineGH-11185] Bugfix: do not use collection batch loading for indexBy assocations. (doctrine#11380) Improve lazy ghost performance by avoiding self-referencing closure. (doctrine#11376)
* 2.19.x: Add missing import Remove unused variable (doctrine#11391) [Documentation] Removing "Doctrine Mapping Types" ... (doctrine#11384) [doctrineGH-11185] Bugfix: do not use collection batch loading for indexBy assocations. (doctrine#11380) Improve lazy ghost performance by avoiding self-referencing closure. (doctrine#11376)
* 2.19.x: Add missing import Remove unused variable (doctrine#11391) [Documentation] Removing "Doctrine Mapping Types" ... (doctrine#11384) [doctrineGH-11185] Bugfix: do not use collection batch loading for indexBy assocations. (doctrine#11380) Improve lazy ghost performance by avoiding self-referencing closure. (doctrine#11376)
* 2.19.x: Add missing import Remove unused variable (doctrine#11391) [Documentation] Removing "Doctrine Mapping Types" ... (doctrine#11384) [doctrineGH-11185] Bugfix: do not use collection batch loading for indexBy assocations. (doctrine#11380) Improve lazy ghost performance by avoiding self-referencing closure. (doctrine#11376)
* 2.19.x: Set column length explicitly (doctrine#11393) Add missing import Remove unused variable (doctrine#11391) [Documentation] Removing "Doctrine Mapping Types" ... (doctrine#11384) [doctrineGH-11185] Bugfix: do not use collection batch loading for indexBy assocations. (doctrine#11380) Improve lazy ghost performance by avoiding self-referencing closure. (doctrine#11376)
* 3.1.x: Adjust PHPBench mocks Set column length explicitly (doctrine#11393) Add missing import Remove unused variable (doctrine#11391) Fixed proxy initialization for EnumReflectionProperty Remove older versions from the docs (doctrine#11383) [Documentation] Removing "Doctrine Mapping Types" ... (doctrine#11384) [doctrineGH-11185] Bugfix: do not use collection batch loading for indexBy assocations. (doctrine#11380) Improve lazy ghost performance by avoiding self-referencing closure. (doctrine#11376) Remove outdated git metadata files (doctrine#11362) Switch join columns around, otherwise index doesnt match Key on fk Fix entities and mapping. Minor code style fix in AbstractRemoteControl Do not schedule batch loading for target classes with composite identifier. Cleanup tests not to use model sets. provides a test case for github issue 11154
* 3.2.x: Adjust PHPBench mocks Set column length explicitly (doctrine#11393) Add missing import Remove unused variable (doctrine#11391) Fixed proxy initialization for EnumReflectionProperty Remove older versions from the docs (doctrine#11383) [Documentation] Removing "Doctrine Mapping Types" ... (doctrine#11384) [doctrineGH-11185] Bugfix: do not use collection batch loading for indexBy assocations. (doctrine#11380) Improve lazy ghost performance by avoiding self-referencing closure. (doctrine#11376) Remove outdated git metadata files (doctrine#11362) Switch join columns around, otherwise index doesnt match Key on fk Fix entities and mapping. Minor code style fix in AbstractRemoteControl Do not schedule batch loading for target classes with composite identifier. Cleanup tests not to use model sets. provides a test case for github issue 11154
Description
Update: bug appears to exists in
3.0.x
as wellThere is a breaking change between
2.16.x
and2.17.x
where for eagerly loaded collectionsindexBy
started looking at the hydrated set of values instead of the raw values returned from the database. This broke setups for all eager associations using either non-scalar fields (Uuid, other entities) or associations where the inverse field's database name didn't match the property name.Affected versions
2.17
2.18
2.19
3.0
3.1
Caused by
Issues
OneToMany::indexBy
no longer works when refering a database column #11097Related