src/Validators/ExistValidator.php
private function valueExists($query, $value)
    {
        if (is_array($value)) {
            return $query->count("DISTINCT [[$this->targetAttribute]]")
                ->then(function($count) use ($value) {
                    return $count == count($value) ? true : reject(new Error("Not exists (count mismatch)"));
                });
        }
        return $query->exists();
    }
private function valueExists($query, $value)
    {
        if (is_array($value)) {
            return $query->count("DISTINCT [[$this->targetAttribute]]")
                ->then(function($count) use ($value) {
                    return $count == count($value) ? true : reject(new Error("Not exists (count mismatch)"));
                });
        }
        return $query->exists();
    }
Check whether value exists in target table

@param QueryInterface $query
@param mixed $value the value want to be checked
@return ExtendedPromiseInterface