我想计算来自乌克兰的用户,但我有一个错误。
[Semantical Error] line 0, col 192 near 'Ukraine GROUP': Error: 'Ukraine' is not defined.
500 Internal Server Error - QueryException
我如何理解问题在于我如何输入乌克兰值。
public function Action(){
$em = $this->getDoctrine()->getEntityManager();
$qb = $em->createQueryBuilder();
$qb->add('select', 'count(user.id) as recount, ur.country, ur.year, ur.month, ur.day')
->add('from','CobaCoreBundle:User ur')
->add('where', $qb->expr()->andx(
'ur.date <= :end',
'ur.date >= :start',
'ur.country = Ukraine'
))
->setParameter('start',$period['fromd'])
->setParameter('end', $period['tod']);
$qb->add('groupBy','ur.year, ur.month, ur.day');
}