Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2422

HIDDEN fileds doesn't work in subqueries

    Details

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

      Description

      I trying to execute query with subquery, which contains GROUP BY:

      $subqueryBuilder = $repository->createQueryBuilder('l2')
          ->select('l2.id, DATE(l2.created) AS HIDDEN created_date')
          ->groupBy('created_date');
      
      $qb = $repository->createQueryBuilder('l');
      $qb->andWhere($qb->expr()->in('l.id', $subqueryBuilder->getDQL()));
      $result = $qb->getQuery()->getArrayResult();
      

      And got error:

      [Syntax Error] line 0, col 80: Error: Expected Doctrine\ORM\Query\Lexer::T_FROM, got ','
      

      If I group simply by "l2.created" without adding it to selected fields, all works fine. But I must use "DATE(l2.created) AS HIDDEN created_date" in selected statement to specify it in GROUP BY statement.

        Activity

          People

          • Assignee:
            Marco Pivetta
            Reporter:
            yetanotherape
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: