I\'m using the PHP Doctrine ORM to build my queries. However, I can\'t quite seem to figure how to write the following WHERE clause using DQL (Doctrine Query Language):
From my experience, each complex where function is grouped within parenthesis (I'm using Doctrine 1.2.1).
$q->where('name = ?', 'ABC')
->andWhere('category1 = ? OR category2 = ? OR category3 = ?', array('X', 'X', 'X'))
->andWhere('price < ?', 10)
produces the following SQL:
WHERE name = 'ABC'
AND (category1 = 'X' OR category2 = 'X' OR category3 = 'X')
AND price < 10