Skip to content


DDC-1995: "Query Exception: Invalid parameter number: number of bound variables does not match number of tokens" when using an "Instance Of" expression #2670

doctrinebot opened this Issue · 4 comments

1 participant


Jira issue originally created by user craigmarvelley:

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 created by craigmarvelley:

Pull request with a potential fix: #429


Comment created by @beberlei:

Assigned to Guilherme


Comment created by @FabioBatSilva:

Fixed : 462173a


Issue was closed with resolution "Fixed"

@doctrinebot doctrinebot added this to the 2.4 milestone
@doctrinebot doctrinebot closed this
@doctrinebot doctrinebot added the Bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.