mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-2870: Doctrine error when using SUM(a.id=1) as ìdentifier: Expected Doctrine\ORM\Query\Lexer::T_CLOSE_PARENTHESIS, got '='
#3581
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Dec 22, 2013).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user c4d3r:
Doctrine error when using SUM(a.id=1) as
ìdentifier: Expected Doctrine\ORM\Query\Lexer::T_CLOSE_PARENTHESIS, got '='I am trying to execute a query in doctrine that contains something like this
SUM(a.id = 1) as
1for some reasons it always gives me the following error:
[Syntax Error] line 0, col 15: Error: Expected Doctrine\ORM\Query\Lexer::T_CLOSE_PARENTHESIS, got '='
This is the code i am using
$result = $em->getRepository('MyBundle:PlayerAction')
->createQueryBuilder('pa')
->select(array(
'SUM(a.id=1) as
1,SUM(a.id=2) as
2,SUM(a.id=3) as
3,p.playerName,
pa.timestamp'
))
->innerJoin('pa.action', 'a')
->innerJoin('pa.player', 'p')
->where('pa.timestamp > ?1')
->groupBy('p')
->setParameter(1, time() - $time)
->orderBy('p.playerName', 'ASC');