Reputation: 15
I want to count my user's who are from Ukraine but i have a error.
[Semantical Error] line 0, col 192 near 'Ukraine GROUP': Error: 'Ukraine' is not defined.
500 Internal Server Error - QueryException
How i understand a problem is in how i enter a Ukraine value.
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');
}
Upvotes: 0
Views: 65
Reputation: 4957
The literal value should be enclosed in speech marks:
'ur.country = "Ukraine"'
Upvotes: 2