Yii2 - andFilterWherefilterWhere() - ignores search by empty values.
When the search is executed by two fields, for example book and author, if the book value is empty then filterWhere() ignores the search by book and the search will be executed only by author
andFilterWhere() - Appends WHERE condition to the existing one.
$query->filterWhere([ 'author' => $author, 'book' => null, ]); // generated sql query // SELECT * FROM `library` WHERE (`author` = $author)
$query->where(['author' => $author]); $query->andFilterWhere(['book' => $book]); // generated sql query // SELECT * FROM `library` WHERE (`author` = $author) AND (`book` = $book)