programmers, I uses symfony doctrine and mongodb. Today I tried to create following query:
$q = $this->createQueryBuilder("user");
$keywords = explode("_", $keyword);
foreach ($keywords as $keyword) {
$r = new \MongoRegex('/'.$keyword.'/i');
$q->addAnd(
$q->addOr($q->expr()->field('firstName')->equals($r))
->addOr($q->expr()->field('lastName')->equals($r))
);
}
return $q->getQuery()->execute();
but after execute() i got following error "zero-length keys are not allowed, did you use $ with double quotes". query must realize user search by keywords. can you help me fix that, please?