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 -
        Hide
        Craig Marvelley added a comment -

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

        Show
        Craig Marvelley added a comment - Pull request with a potential fix: https://github.com/doctrine/doctrine2/pull/429
        Hide
        Benjamin Eberlei added a comment -

        Assigned to Guilherme

        Show
        Benjamin Eberlei added a comment - Assigned to Guilherme
        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 ]
        Show
        Fabio B. Silva added a comment - Fixed : https://github.com/doctrine/doctrine2/commit/462173ad71ae63cd9877e1e642f7968ed1f9971b
        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 ]

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DDC-1995, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

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

            Dates

            • Created:
              Updated:
              Resolved: