Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Doctrine findBy with OR condition

Is it possible to use OR statement in Doctrine findBy() method? I know that given array is interpreted as case1 AND case2... Like this

$this->repos['notif']->findBy(array('status' => 1, 'status' => 2, 'status' => 3); 

Stands for

SELECT * FROM `notif` WHERE status=1 AND status=2 AND status=3; 

Now I need something to stand for:

SELECT * FROM `notif` WHERE status=1 OR status=2 OR status=3; 

Is there a way to get all cases?

like image 893
ArVan Avatar asked Feb 13 '12 10:02

ArVan


1 Answers

You can write:

$this->repos['notif']->findBy(array('status' => array(1, 2, 3))); 

and that should work too.

like image 169
user3012985 Avatar answered Sep 20 '22 17:09

user3012985