How to use andWhere and orWhere in Doctrine?

前端 未结 4 1925
萌比男神i
萌比男神i 2020-12-05 22:40
WHERE a = 1 AND (b = 1 Or b = 2) AND (c = 1 OR c = 2)

How can i make this in Doctrine?

$q->where(\"a = 1\");
$q->andWhere(\"b         


        
4条回答
  •  囚心锁ツ
    2020-12-05 22:55

    Why not just

    $q->where("a = 1");
    $q->andWhere("b = 1 OR b = 2");
    $q->andWhere("c = 1 OR d = 2");
    

    EDIT: You can also use the Expr class (Doctrine2).

提交回复
热议问题