It tries to be smart about where and how the field is defined.
$field can be passed as:
- string (field name in this model)
- Field object
- DSQL expression
- array (see note below)
$cond can be passed as:
- string ('=', '>', '<=', etc.)
- value can be passed here, then it's used as $value with condition '='
$value can be passed as:
- string, integer, boolean or any other simple data type
- Field object
- DSQL expreession
NOTE: $field can be passed as array of conditions. Then all conditions
will be joined with OR using DSQLs orExpr method.
For example,
$model->addCondition(array(
array('profit', '=', null),
array('profit', '<', 1000),
));
will generate "WHERE profit is null OR profit < 1000"
EXAMPLES:
you can pass [dsql, dsql, dsql ...] and this will be treated
as (dsql OR dsql OR dsql) ...
you can pass [[field,cond,value], [field,cond,value], ...] and this will
be treated as (field=value OR field=value OR ...)
BTW, you can mix these too :)
[[field,cond,value], dsql, [field,cond,value], ...]
will become (field=value OR dsql OR field=value)
Value also can be DSQL expression, so following will work nicely:
[dsql,'>',dsql] will become (dsql > dsql)
[dsql, dsql] will become (dsql = dsql)
[field, cond, dsql] will become (field = dsql)