Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.1
    • Fix Version/s: 2.0.4
    • Component/s: DQL
    • Security Level: All
    • Labels:
      None

      Description

      This query will crash Doctrine 2:

      SELECT wpomOrder.documentDate
                                 FROM \persistentData\model\import\webProductionOrderManager\WPOMOrder wpomOrder
                               GROUP BY wpomOrder
      

      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.

        Issue Links

          Activity

          Hide
          Daniel Alvarez Arribas added a comment - - edited

          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:

          SELECT wpomOrder.documentDate
                                     FROM \persistentData\model\import\webProductionOrderManager\WPOMOrder wpomOrder
                                   GROUP BY wpomOrder.documentDate
          

          Note that it groups the results by the expression used in the select clause rather than just the entity like in the example above.

          Show
          Daniel Alvarez Arribas added a comment - - edited 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: SELECT wpomOrder.documentDate FROM \persistentData\model\ import \webProductionOrderManager\WPOMOrder wpomOrder GROUP BY wpomOrder.documentDate Note that it groups the results by the expression used in the select clause rather than just the entity like in the example above.
          Hide
          Benjamin Eberlei added a comment -

          Fixed, group by identification variable is now supported. Merged into 2.0.x

          Added follow up task for 3.0 cleanup DDC-1073

          Show
          Benjamin Eberlei added a comment - Fixed, group by identification variable is now supported. Merged into 2.0.x Added follow up task for 3.0 cleanup DDC-1073

            People

            • Assignee:
              Benjamin Eberlei
              Reporter:
              Daniel Alvarez Arribas
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: