private function checkTargetRelationExistence($model, $attribute)
    {
        /** @var ActiveQuery $relationQuery */
        $relationQuery = $model->{'get' . ucfirst($this->targetRelation)}();

        if ($this->filter instanceof \Closure) {
            call_user_func($this->filter, $relationQuery);
        } elseif ($this->filter !== null) {
            $relationQuery->andWhere($this->filter);
        }

        return $relationQuery->exists()
            ->then(null, function() use ($model, $attribute) {
                $this->addError($model, $attribute, $this->message);
                return null;
            });
    }