I have the following query:
$query = Doctrine_Query::create()
->from('Member m')
->where("m.type='1'")
->andWhere("m.name LIKE '%$term%'")
->orWhere("m.surname LIKE '%$term%'")
->orWhere("m.company LIKE '%$term%'")
->orderBy('id DESC');
But it’s not working like I want — it is ignoring type column.
What I need is result set where m.type=1 and some of other fields in this query is LIKE 'something'.
Your OR conditions didn’t include the first condition. It’s also recommended to use the
?for your variables to ensure Doctrine escapes them.