【发布时间】:2017-03-15 07:07:45
【问题描述】:
我需要你的帮助,我将如何将以下 Mysql 转换为 Doctrine。
select * from calendar_data as c where LEAST(c.end, end) - GREATEST(c.start, start) > 0;
我试过这个:
$qb = $em->createQueryBuilder();
$query = $qb->select('items')
->from('\Admin\Entity\CalendarData','items')
->where('LEAST(items.end, :end) - GREATEST(items.start, :start) > 0')
->setParameter('start',$start)
->setParameter('end', $end);
(鉴于 $start 和 $end 已经提供)
我有以下错误:
{
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html",
"title": "Internal Server Error",
"status": 500,
"detail": "[Syntax Error] line 0, col 57: Error: Expected known function, got 'LEAST'"
}
我该怎么做?
这是我的问题生成的 sql:
Mysql query to determine if the given datetime is included in the datetime interval
【问题讨论】:
标签: php mysql symfony doctrine-orm doctrine