I’m looking into the Database API to do a simple like with ActiveRecord, and i read the phpdoc of the CDBCriteria::compare method which say :
So does that means that web user can set himself a specific operator (when code isn’t specifying one) at the beginning of an input so the SQL query will be modified in some ways ?
That behavior seems ugly, another parameter which is not concatenated would be better.
You can see that behavior implemented in gii-generated admin page. The advanced search form and the inline filter of the grid support the operators like ">", "<", ">=", "<=", … etc.
Well, I think it’s simple and convenient both for the advanced users and the programmers, because it doesn’t require extra UI element and additional coding.
Of course we would want to create a sophisticated user-friendly UI that supports optional operators for general users. Then we would have to do some extra coding for the search form. But we can still use "compare()" with a minimum additional code for that case also.