2
我得到實體特派團,一個任務得到了收集實體與一對多, 我想選擇比任務中設置的少於最大參與者的任務,我嘗試了一些,但是指望一對多關係不存在如何選擇實體與聯盟一對多實體大於零
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();
}
[Semantical Error] line 0, col 346 near 'collects) < m.maxParticipant': Error: Invalid PathExpression. StateFieldPathExpression or SingleValuedAssociationField expected.
我該怎麼做最後的測試? :andWhere('count(m.collections)< m.maxParticipant');
號,COL 365附近 '收集)<':錯誤:無效PathExpression。 StateFieldPathExpression或SingleValuedAssociationField預計。 – user1804164
和'count(m.collects.id)'? – Matteo