Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: 2.3
    • Fix Version/s: None
    • Component/s: ORM
    • Labels:
      None
    • Environment:
      Linux, Symfony 2, PHP 5.3.10

      Description

      I'm going by the docs, trying to get a WHERE IN type of query working with the query builder.

      I've got a flat array of IDs, e.g. something like this:

      $IDs = array( 228052, 265635, 344498, 391761, 329203, 317911, 305961, 299939, 249429, 344706 );

      I've tried the following ways to get this working:

      • using the Expr class:

      $qb->add( 'where', $qb->expr()->in( 'c.id', ':IDs' ));
      $qb->setParameter( 'IDs', $IDs );

      • alternatively:

      $qb->add( 'where', $qb->expr()->in( 'c.id', $IDs ));

      • even direct DQL:

      $qb->where( 'c.id IN (:IDs)' );
      $qb->setParameter( 'IDs', $IDs );

      The generated DQL looks fine:

      SELECT c FROM MyEntity c WHERE c.id IN('228052', '265635', '344498', '391761', '329203', '317911', '305961', '299939', '249429', '344706')

      But when I call execute() on that query, all these variations give me the following error:

      Expected argument of type "Doctrine\ORM\QueryBuilder", "array" given

        Activity

        Moritz Kraft created issue -
        Moritz Kraft made changes -
        Field Original Value New Value
        Description I'm going by the docs, trying to get a WHERE IN type of query working with the query builder.

        I've got a flat array of IDs, e.g. something like this:

          $IDs = array( 5, 234, 23497 );

        I've tried the following ways to get this working:

        - using the Expr class:

          $qb->add( 'where', $qb->expr()->in( 'c.id', ':IDs' ));
          $qb->setParameter( 'IDs', $IDs );

        - alternatively:

          $qb->add( 'where', $qb->expr()->in( 'c.id', $IDs ));

        - even direct DQL:

          $qb->where( 'c.id IN (:IDs)' );
          $qb->setParameter( 'IDs', $IDs );

        The generated DQL looks fine:

          SELECT c FROM MyEntity c WHERE c.id IN('228052', '265635', '344498', '391761', '329203', '317911', '305961', '299939', '249429', '344706')

        But when I call execute() on that query, all these variations give me the following error:

          Expected argument of type "Doctrine\ORM\QueryBuilder", "array" given
        I'm going by the docs, trying to get a WHERE IN type of query working with the query builder.

        I've got a flat array of IDs, e.g. something like this:

          $IDs = array( 228052, 265635, 344498, 391761, 329203, 317911, 305961, 299939, 249429, 344706 );

        I've tried the following ways to get this working:

        - using the Expr class:

          $qb->add( 'where', $qb->expr()->in( 'c.id', ':IDs' ));
          $qb->setParameter( 'IDs', $IDs );

        - alternatively:

          $qb->add( 'where', $qb->expr()->in( 'c.id', $IDs ));

        - even direct DQL:

          $qb->where( 'c.id IN (:IDs)' );
          $qb->setParameter( 'IDs', $IDs );

        The generated DQL looks fine:

          SELECT c FROM MyEntity c WHERE c.id IN('228052', '265635', '344498', '391761', '329203', '317911', '305961', '299939', '249429', '344706')

        But when I call execute() on that query, all these variations give me the following error:

          Expected argument of type "Doctrine\ORM\QueryBuilder", "array" given
        Hide
        Moritz Kraft added a comment -

        never mind.... it was something i was doing wrong. thank god...

        Show
        Moritz Kraft added a comment - never mind.... it was something i was doing wrong. thank god...
        Moritz Kraft made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Marco Pivetta made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Marco Pivetta made changes -
        Status Reopened [ 4 ] Closed [ 6 ]
        Resolution Invalid [ 6 ]
        Hide
        Marco Pivetta added a comment -

        Moritz Kraft what was it exactly?

        Show
        Marco Pivetta added a comment - Moritz Kraft what was it exactly?
        Hide
        Moritz Kraft added a comment -

        The error was thrown by the Symfony Form Framework, not Doctrine. Sorry about that. :-/

        Show
        Moritz Kraft added a comment - The error was thrown by the Symfony Form Framework, not Doctrine. Sorry about that. :-/

        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-2177, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Moritz Kraft
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: