Jira issue originally created by user michalz:
* @param int $companyId
* @param bool $includeDeleted
* @return \Doctrine\ORM\QueryBuilder
public function findCompanySubjects($companyId, $includeDeleted = false)
->andWhere('t.deleted = :deleted')
->andWhere('company.id = :id')
Code above does not work for me. I'm still getting an error "Invalid parameter number: number of bound variables does not match number of tokens". However, bound parameters does work with raw DQL and the Query object.
Comment created by @ocramius:
[~michalz] what is the complete DQL that is produced for that query? And does it work with a DQL query written directly (rather than the QB)?
Comment created by michalz:
Raw DQL is:
SELECT t, owner FROM Domain\Entity\Subject t INNER JOIN t.owner owner INNER JOIN owner.company company WHERE t.deleted = :deleted AND company.id = :id ORDER BY t.name asc
And yes, it does work with a DQL query written directly:
// $qb from above
'deleted' => $includeDeleted,
'id' => $companyId
debug($query->getArrayResult()); // returns a list of subjects
You are returning the QB in your reported code - I'm pretty sure that some interaction with it is going on at a later point in time.
Could you provide the code that is causing the problem? Otherwise, this doesn't look like a bug to me.
Issue was closed with resolution "Invalid"