How can write query like in doctrine2
SELECT * from table where field = value1 or field = value2
I found something like
$em->getRepository('myentitity')
->findBy(
array('field' => 'value1','field'=>'value2'), // $where
);
But I think it is AND .. Please suggest me Thanks
try this
$em->getRepository('myentitity')
->findBy(
array('field' =>array( 'value1','value2')) // $where
);
If you pass an array of values Doctrine will convert the query into a WHERE field IN (..) query automatically:
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