mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-1053: GROUP BY crashes Doctrine 2 #1311
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 @doctrinebot on GitHub (Mar 1, 2011).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user dalvarez:
This query will crash Doctrine 2:
Here is the hard error I get:
Catchable fatal error: Argument 1 passed to Doctrine\ORM\Query\SqlWalker::walkGroupByItem() must be an instance of Doctrine\ORM\Query\AST\PathExpression, string given in /var/www/invoiceCreator/src/thirdPartyComponents/doctrine/Doctrine/ORM/Query/SqlWalker.php on line 1203
Of course, the query shown is pointless. I reduced it from a more complex statement to illustrate that it is actually the GROUP BY that breaks Doctrine. Even in a meaningful scenario with aggregates, it would not work.
@doctrinebot commented on GitHub (Mar 1, 2011):
@doctrinebot commented on GitHub (Mar 1, 2011):
Comment created by dalvarez:
The query shown above could as well be invalid, because it groups the results by something which is not in the select clause. I do not know if this should be a requirement, though, since I can think of use cases where you would want to group by something, but still not select it. Anyway, this query will work:
Note that it groups the results by the expression used in the select clause rather than just the entity like in the example above.
@doctrinebot commented on GitHub (Mar 20, 2011):
Comment created by @beberlei:
Fixed, group by identification variable is now supported. Merged into 2.0.x
Added follow up task for 3.0 cleanup DDC-1073
@doctrinebot commented on GitHub (Mar 20, 2011):
Issue was closed with resolution "Fixed"