public function search($params)
{
$qb = $this->createQueryBuilder('auto');
if (isset($params['manufacturer'])) {
$qb->join('auto.manufacturer', 'man')
->where('man.manufacturer = :manufacturer')
->setParameter('manufacturer', $params['manufacturer']);
}
if (isset($params['model'])) {
$qb->join('auto.model', 'mod')
->where('mod.model = :model')
->setParameter('model', $params['model']);
}
return $qb->getQuery()->getResult();
}
查询返回错误:
无效的参数号:绑定变量的数量与标记的数量不匹配