1
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();
}
查詢返回錯誤:多連接查詢生成器doctrine2
Invalid parameter number: number of bound variables does not match number of tokens
你可以var_dump $ params? – AlterPHP
array() 'manufacturer'=> string'Opel'(length = 4) 'model'=> string'45'(length = 2) – korvinko