I just write my first phalcon application and ask a question to filter the request using Phalcon \ Mvc \ Model \ Criteria.
Finally, I want a query like this
SELECT * FROM table WHERE status = 'A' AND ( title LIKE 'combining%' OR title LIKE 'phalcon%' OR ( title LIKE 'criteria%' AND title LIKE '%phalcon' ) )
For me, there seems to be no way of parentheses in the criteria for a model of Falcons. The only way to achieve this is to write phql.
Instead of writing full phql, I can probably write something like this, but it gets the same complexity
<?php $query = Table::query(); $query->where('status = :status:', array('status' => 'A')); $query->andWhere('( title LIKE :title1: OR title LIKE :title2: OR ( title LIKE :title3: AND title LIKE :title4: ) )', array( 'title1' => 'combining%', 'title2' => 'phalcon%', 'title3' => 'criteria%', 'title4' => '%phalcon' ));
source share