DDC-2422: HIDDEN fileds doesn't work in subqueries #3037

Open
opened 2026-01-22 14:10:28 +01:00 by admin · 0 comments
Owner

Originally created by @doctrinebot on GitHub (Apr 29, 2013).

Originally assigned to: @Ocramius on GitHub.

Jira issue originally created by user yetanotherape:

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.

Originally created by @doctrinebot on GitHub (Apr 29, 2013). Originally assigned to: @Ocramius on GitHub. Jira issue originally created by user yetanotherape: 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.
admin added the Bug label 2026-01-22 14:10:28 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#3037