Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1356

DQL does not accept a parameter containing Entities

    Details

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

      Description

      Currently, it is impossible to provide an argument that is a collection of Entities. Example:

      $userA = new CmsUser;
      $userA->name = 'Benjamin';
      $userA->username = 'beberlei';
      $userA->status = 'developer';
      $this->_em->persist($userA);
              
      $userB = new CmsUser;
      $userB->name = 'Roman';
      $userB->username = 'romanb';
      $userB->status = 'developer';
      $this->_em->persist($userB);
      
      $this->_em->flush();
      $this->_em->clear();
      
      $query = $this->_em->createQuery("SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u IN (?0)");
      $query->setParameter(0, array($userA, $userB));
      

      Returns this error currently:

      Object of class Doctrine\Tests\Models\CMS\CmsUser could not be converted to string
      

        Activity

        Show
        Guilherme Blanco added a comment - Fixed in https://github.com/doctrine/doctrine2/commit/3b3186ee98392802a44118cd421a3530119aa7ea
        Hide
        Benjamin Eberlei added a comment -

        Merged

        Show
        Benjamin Eberlei added a comment - Merged

          People

          • Assignee:
            Guilherme Blanco
            Reporter:
            Guilherme Blanco
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: