DDC-1356: DQL does not accept a parameter containing Entities #1701

Closed
opened 2026-01-22 13:22:38 +01:00 by admin · 3 comments
Owner

Originally created by @doctrinebot on GitHub (Sep 1, 2011).

Originally assigned to: @guilhermeblanco on GitHub.

Jira issue originally created by user @guilhermeblanco:

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
Originally created by @doctrinebot on GitHub (Sep 1, 2011). Originally assigned to: @guilhermeblanco on GitHub. Jira issue originally created by user @guilhermeblanco: 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 ```
admin added the Bug label 2026-01-22 13:22:38 +01:00
admin closed this issue 2026-01-22 13:22:38 +01:00
Author
Owner

@doctrinebot commented on GitHub (Sep 1, 2011):

Comment created by @guilhermeblanco:

Fixed in 3b3186ee98

@doctrinebot commented on GitHub (Sep 1, 2011): Comment created by @guilhermeblanco: Fixed in https://github.com/doctrine/doctrine2/commit/3b3186ee98392802a44118cd421a3530119aa7ea
Author
Owner

@doctrinebot commented on GitHub (Sep 1, 2011):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Sep 1, 2011): Issue was closed with resolution "Fixed"
Author
Owner

@doctrinebot commented on GitHub (Sep 4, 2011):

Comment created by @beberlei:

Merged

@doctrinebot commented on GitHub (Sep 4, 2011): Comment created by @beberlei: Merged
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#1701