[DDC-1995] "Query Exception: Invalid parameter number: number of bound variables does not match number of tokens" when using an "Instance Of" expression Created: 22/Aug/12  Updated: 07/Jun/13  Resolved: 07/Jun/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: DQL
Affects Version/s: Git Master
Fix Version/s: 2.4
Security Level: All

Type: Bug Priority: Major
Reporter: Craig Marvelley Assignee: Fabio B. Silva
Resolution: Fixed Votes: 0
Labels: None


Similar to this issue I think, but triggered when performing a query on entities modelled with Class Table Inheritance, e.g.

$qb = $repository->createQueryBuilder('entity');
$metadata = $em->getClassMetadata($class);
$qb->where('entity INSTANCE OF :type')->setParameter('type', $metadata);

Seems that there isn't a corresponding entry in the parameter mapping array for this clause, which triggers the exception at line 254 of Doctrine\ORM\Query:

if (count($paramMappings) != count($this->parameters)) {
throw QueryException::invalidParameterNumber();

Comment by Craig Marvelley [ 22/Aug/12 ]

Pull request with a potential fix: https://github.com/doctrine/doctrine2/pull/429

Comment by Benjamin Eberlei [ 29/Aug/12 ]

Assigned to Guilherme

Comment by Fabio B. Silva [ 07/Jun/13 ]

Fixed : https://github.com/doctrine/doctrine2/commit/462173ad71ae63cd9877e1e642f7968ed1f9971b

Generated at Wed Nov 25 18:56:22 EST 2015 using JIRA 6.4.10#64025-sha1:5b8b74079161cd76a20ab66dda52747ee6701bd6.