Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1201

DQL Example about count(*) related entity is wrong

    Details

    • Type: Documentation Documentation
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.1.1
    • Fix Version/s: None
    • Component/s: Documentation
    • Security Level: All
    • Labels:
      None

      Description

      DQL Example about count related entity is wrong

        Activity

        Hide
        Aigars Gedroics added a comment -

        Also similar DQL in documentation URL http://www.doctrine-project.org/docs/orm/2.1/en/reference/dql-doctrine-query-language.html#pure-and-mixed-results fails parsing stage:

        $dql = "SELECT u, 'some scalar string', count(u.groups) AS num FROM User u JOIN u.groups g GROUP BY u.id";
        

        with error

          [Doctrine\ORM\Query\QueryException]                                                                                                                         
          [Semantical Error] line 0, col 40 near 'localizations)': Error: Invalid PathExpression. StateFieldPathExpression or SingleValuedAssociationField expected. 
        

        Should be "count(g.id)" instead of "count(u.groups)".

        Show
        Aigars Gedroics added a comment - Also similar DQL in documentation URL http://www.doctrine-project.org/docs/orm/2.1/en/reference/dql-doctrine-query-language.html#pure-and-mixed-results fails parsing stage: $dql = "SELECT u, 'some scalar string', count(u.groups) AS num FROM User u JOIN u.groups g GROUP BY u.id" ; with error [Doctrine\ORM\Query\QueryException] [Semantical Error] line 0, col 40 near 'localizations)': Error: Invalid PathExpression. StateFieldPathExpression or SingleValuedAssociationField expected. Should be "count(g.id)" instead of "count(u.groups)".

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Benjamin Eberlei
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: