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 have types in array How can I pass this array to my query builder?
$qb->andWhere($qb->expr()->orx(CONDITIONS));   List of types will be dynamic, calling $qb->andWhere on each foreach types loop will make only more AND WHERE's no more ORs. 
Can I store multiply orx expressions and then add it to andWhere? Any idea how to solve this, probably, common problem?
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); 
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With