yii\db\QueryTrait::filterWhere PHP Method

filterWhere() public method

This method is similar to QueryTrait::where. The main difference is that this method will remove [[isEmpty()|empty query operands]]. As a result, this method is best suited for building query conditions based on filter values entered by users. The following code shows the difference between this method and QueryTrait::where: php WHERE age=:age $query->filterWhere(['name' => null, 'age' => 20]); WHERE age=:age $query->where(['age' => 20]); WHERE name IS NULL AND age=:age $query->where(['name' => null, 'age' => 20]); Note that unlike QueryTrait::where, you cannot pass binding parameters to this method.
See also: where()
See also: andFilterWhere()
See also: orFilterWhere()
public filterWhere ( array $condition )
$condition array the conditions that should be put in the WHERE part. See [[where()]] on how to specify this parameter.
    public function filterWhere(array $condition)
    {
        $condition = $this->filterCondition($condition);
        if ($condition !== []) {
            $this->where($condition);
        }
        return $this;
    }