【发布时间】:2017-03-02 15:28:15
【问题描述】:
我得到了实体任务,一个任务得到了用 oneToMany 收集实体, 我想选择少于任务中设置的 maxParticipant 的任务,我尝试了一些但指望 oneToMany 关系不存在
public function getMissionGroupByCities()
{
$qb = $this->createQueryBuilder('m')
->select('COUNT(m) as count_project, m_city.id as id, IDENTITY(m_city.nameLibelle) as libelle, m_city.latitude, m_city.longitude')
->leftJoin('m.project', 'm_project')
->leftJoin('m.city', 'm_city')
->groupBy('m.city')
->where('m_project.state IN (2,3,4)')
->andWhere('CURRENT_TIMESTAMP() < m_project.dateEnd')
->andWhere('CURRENT_TIMESTAMP() < m.dateBegin')
->andWhere('count(m.collects) < m.maxParticipant');
return $qb->getQuery()->getResult();
}
[语义错误] line 0, col 346 near 'collects)
我怎样才能做最后的测试? :andWhere('count(m.collects)
【问题讨论】:
标签: symfony doctrine-orm