【发布时间】:2013-04-15 14:28:49
【问题描述】:
经过多次尝试,我想我终于把文档牢记在心了。 然后,我需要你的帮助.. 我不明白为什么 Doctrine 会显示这个错误:
无效的参数号:绑定变量的数量不匹配 代币数量
这是我的代码:
$qb = $this->em->createQueryBuilder();
$qb->select('m')
->from('Entities\Marque', 'm')
->leftJoin('m.magasin', 'ma')
->where('m.nom = :marque AND ma.nom LIKE :magasin')
->setParameter('marque', $marque)
->setParameter('magasin', '%'.$matchesNumber[1].'%');
$results = $qb->getQuery()->getArrayResult();
提前感谢您的回答。
【问题讨论】:
-
你可能会在稍后调用 $db->where 吗?这将覆盖现有的 where 语句。
-
不,这是 where 语句的唯一用途。
-
$marque和$matchesNumber[1]不为空吗?
标签: php symfony doctrine-orm