Chaining orX in Doctrine2 query builder

后端 未结 2 1039
醉梦人生
醉梦人生 2020-12-16 13:58

I have to dynamically add OR expressions to the query builder returned by getListQueryBuilder, right after adding a where clause. I ca

2条回答
  •  温柔的废话
    2020-12-16 14:37

    You can check this solution:

    $orX = $builder->expr()->orX();
    foreach($ORs as $or) {
        $orX->add($or);
    }
    $builder->andWhere($orX);
    

提交回复
热议问题