DDC-1100: INSTANCE OF and IN in QueryBuilder #1374

Open
opened 2026-01-22 13:12:20 +01:00 by admin · 0 comments
Owner

Originally created by @doctrinebot on GitHub (Apr 4, 2011).

Originally assigned to: @guilhermeblanco on GitHub.

Jira issue originally created by user vrtak-cz:

I need to obtain specific entity instances. And I don't know how to write better solution for my problem

$nodes = array('Entities\FooNode', 'Entities\BarNode');

$qb->select('Entities\Node', 'n')->where("n.level = 1"); 
$classes = array(); 
foreach ($nodes as $class) { 
        $classes[] = "n INSTANCE OF " . $class; 
} 

$qb->andWhere(call*user_func*array(array($qb->expr(), 'orx'), $classes))); 
Originally created by @doctrinebot on GitHub (Apr 4, 2011). Originally assigned to: @guilhermeblanco on GitHub. Jira issue originally created by user vrtak-cz: I need to obtain specific entity instances. And I don't know how to write better solution for my problem ``` $nodes = array('Entities\FooNode', 'Entities\BarNode'); $qb->select('Entities\Node', 'n')->where("n.level = 1"); $classes = array(); foreach ($nodes as $class) { $classes[] = "n INSTANCE OF " . $class; } $qb->andWhere(call*user_func*array(array($qb->expr(), 'orx'), $classes))); ```
admin added the New Feature label 2026-01-22 13:12:20 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#1374