Complex WHERE clauses using the PHP Doctrine ORM

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

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)