Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1995

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

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: Git Master
    • Fix Version/s: 2.4
    • Component/s: DQL
    • Security Level: All
    • Labels:
      None

      Description

      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);
      $qb->getQuery()->execute();

      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(); }

        Activity

        Craig Marvelley created issue -
        Benjamin Eberlei made changes -
        Field Original Value New Value
        Assignee Benjamin Eberlei [ beberlei ] Guilherme Blanco [ guilhermeblanco ]
        Fabio B. Silva made changes -
        Assignee Guilherme Blanco [ guilhermeblanco ] Fabio B. Silva [ fabio.bat.silva ]
        Fabio B. Silva made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.4 [ 10321 ]
        Fix Version/s Git Master [ 10100 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Fabio B. Silva
            Reporter:
            Craig Marvelley
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: