【发布时间】:2015-11-06 10:36:30
【问题描述】:
我需要上个月创建的表中的所有数据。我已经创建了下面的代码,但是它在 DQL 中给出了以下错误,但是运行它时 SQL 查询是正确的。
错误:
[Syntax Error] line 0, col 138: Error: Expected Doctrine\ORM\Query\Lexer::T_CLOSE_PARENTHESIS, got '-'
代码是;
$compCases = $this->getDoctrine()
->getRepository('EFuturesCrmBundle:CasesCompensation')
->createQueryBuilder('c')
->select('c.id')
->where('c.caseStatus =:status')
->andWhere('YEAR(c.caseStatusDate) = YEAR(CURRENT_DATE - INTERVAL 1 MONTH)')
->andWhere('MONTH(c.caseStatusDate) = MONTH(CURRENT_DATE - INTERVAL 1 MONTH)')
->setParameter('status', 'resolve')
->getQuery()
->getResult();
INTERVAL 不支持 DQL,那么这在 Doctrine2 中怎么可能?
【问题讨论】:
标签: symfony doctrine-orm