You need to pass the exact number of parameters.
public function getByPartial($q, Company $company) { $query = $this->createQueryBuilder('u') ->join('u.company','c') ->where('u.firstName LIKE :q1 OR u.lastName LIKE :q2') ->andWhere('c.id = :company_id') ->setParameters(array('company_id' => $company->getId(), 'q1' => '%'.$q.'%', 'q2' => '%'.$q.'%')) ->getQuery(); return $query->getResult(); }
EDITED The connection does not accept any object parameters. Documentation
source share