framework/validators/UniqueValidator.php
private function prepareQuery($targetClass, $conditions)
    {
        $query = $targetClass::find();
        $query->andWhere($conditions);
        if ($this->filter instanceof \Closure) {
            call_user_func($this->filter, $query);
        } elseif ($this->filter !== null) {
            $query->andWhere($this->filter);
        }

        return $query;
    }
private function prepareQuery($targetClass, $conditions)
    {
        $query = $targetClass::find();
        $query->andWhere($conditions);
        if ($this->filter instanceof \Closure) {
            call_user_func($this->filter, $query);
        } elseif ($this->filter !== null) {
            $query->andWhere($this->filter);
        }

        return $query;
    }
private function prepareQuery ( $ targetClass , $ conditions ) { $ query = $ targetClass :: find ( ) ; $ query -> andWhere ( $ conditions ) ; if ( $ this -> filter instanceof \ Closure ) { call_user_func ( $ this -> filter , $ query ) ; } elseif ( $ this -> filter !== null ) { $ query -> andWhere ( $ this -> filter ) ; } return $ query ; }
Prepares a query by applying filtering conditions defined in $conditions method property
and [[filter]] class property.

@param ActiveRecordInterface $targetClass the name of the ActiveRecord class that should be used to validate
the uniqueness of the current attribute value.
@param array $conditions conditions, compatible with [[\yii\db\Query::where()|Query::where()]] key-value format

@return ActiveQueryInterface|ActiveQuery
Prepares a query by applying filtering conditions defined in $conditions method property and [[ filter ]] class property .