I need to construct DQL with a QueryBuilder
like this
[QUERY]... AND WHERE e.type = x OR e.type = Y OR e.type = N [...]
I hav
I hope so, then I found this :
$conditions = array('e.type = x', 'e.type = Y', 'e.type = N');
$orX = $qb->expr()->orX();
foreach ($conditions as $condition) {
$orX->add($condition);
}
$qb->add('where', $orX);
Using @meze suggestion, you can simplify the code and replace the foreach statement with:
$orX->addMultiple($conditions);