It is important to notice that when calling this function, any previous set
of conditions defined for this query will be treated as a single argument for
the AND operator. This function will not only operate the most recently defined
condition, but all the conditions as a whole.
When using an array for defining conditions, creating constraints form each
array entry will use the same logic as with the where() function. This means
that each array entry will be joined to the other using the AND operator, unless
you nest the conditions in the array using other operator.
### Examples:
$query->where(['title' => 'Hello World')->andWhere(['author_id' => 1]);
Will produce:
WHERE title = 'Hello World' AND author_id = 1
$query
->where(['OR' => ['published' => false, 'published is NULL']])
->andWhere(['author_id' => 1, 'comments_count >' => 10])
Produces:
WHERE (published = 0 OR published IS NULL) AND author_id = 1 AND comments_count > 10
$query
->where(['title' => 'Foo'])
->andWhere(function ($exp, $query) {
return $exp
->add(['author_id' => 1])
->or_(['author_id' => 2]);
});
Generates the following conditions:
WHERE (title = 'Foo') AND (author_id = 1 OR author_id = 2)