-
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
Issue with toIterable() and selecting multiple entities #8413
Milestone
Comments
Cartman34
pushed a commit
to Cartman34/orm
that referenced
this issue
Jan 6, 2021
Fix doctrine#8413 Now allowing to select multiple entities and return all of them
Can you please show your code example and add the current result as also your expected result? |
Ok, so this is a summary version of my code:
|
beberlei
added a commit
to beberlei/doctrine2
that referenced
this issue
Feb 8, 2021
When multiple entity results are part of a row, the result handling must be different. In addition mixed results with scalars are broken and now throw an exception as illegal operation.
beberlei
added a commit
to beberlei/doctrine2
that referenced
this issue
Feb 8, 2021
beberlei
added a commit
to beberlei/doctrine2
that referenced
this issue
Feb 16, 2021
When multiple entity results are part of a row, the result handling must be different. In addition mixed results with scalars are broken and now throw an exception as illegal operation.
beberlei
added a commit
to beberlei/doctrine2
that referenced
this issue
Feb 16, 2021
beberlei
added a commit
that referenced
this issue
Feb 16, 2021
* [GH-8410] Fix memory leak in new toIterable and state bug. The new AbstractQuery::toIterable() had a memory leak that AbstractQuery::iterable() did not have. This leak is now fixed. After fixing the leak, one test failed where the identity map in ObjectHydrator triggered and lead to a notice. Introduced a new AbstractHydrator::cleanupAfterRowIteration() that the ObjectHydrator uses to cleanup the state. * [GH-8413] Bugfix: Iterating with multiple, mixed results When multiple entity results are part of a row, the result handling must be different. In addition mixed results with scalars are broken and now throw an exception as illegal operation. * Housekeeping: phpcs * [GH-8413] Add assertions for entity alias iteration. * [GH-8387] Missing @deprecated on Query::iterate
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My code was previously working and since the last update, all the application is down due to toIterable() returning only the last entity when selecting multiple entities.
At line 179 in AbstractHydrator, Doctrine is doing yield end($result); causing the issue, the call to end() function should not be used.
$result is a simple array containing all retrieved entities, calling end() is just returning the last one.
orm/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php
Line 179 in 378944d
I tested and the solution is really simple: Just remove the end() call, only yield $result;
This may be related to #8410
The text was updated successfully, but these errors were encountered: