Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1077

Specifying a constant value in the SELECT clause causes parser error

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.2
    • Fix Version/s: 2.0.4
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None

      Description

      User group post: http://groups.google.com/group/doctrine-user/browse_thread/thread/7f49cf9ff36d0750

      Specifying a value in the select clause, such as the following, causes a parser error:

      queryBuilder->select('p.name as name, \'foo\' as bar')>from>('Person p');

      The equivalent SQL would be:

      SELECT p.name as name, 'foo' as bar FROM person;

      And would result in something like the following:

      name bar
      ---------------
      steve foo
      john foo
      sally foo

      The error output:

      Doctrine\ORM\Query\QueryException : [Syntax Error] line 0, col 136: Error:

      Expected IdentificationVariable | StateFieldPathExpression | AggregateExpression | "(" Subselect ")" | ScalarExpression, got 'foo'

      Doctrine/ORM/Query/Parser.php(393): syntaxError()

        Issue Links

          Activity

          Hide
          Benjamin Eberlei added a comment -

          Fixed

          Show
          Benjamin Eberlei added a comment - Fixed

            People

            • Assignee:
              Benjamin Eberlei
              Reporter:
              Kevin McBride
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: