diff --git a/framework/validators/ExistValidator.php b/framework/validators/ExistValidator.php index 8bbcd69195..eb86088d31 100644 --- a/framework/validators/ExistValidator.php +++ b/framework/validators/ExistValidator.php @@ -169,7 +169,7 @@ class ExistValidator extends Validator $conditions[] = $params; } - $targetClass = $this->targetClass === null ? get_class($model) : $this->targetClass; + $targetClass = $this->getTargetClass($model); $query = $this->createQuery($targetClass, $conditions); if (!$this->valueExists($targetClass, $query, $model->$attribute)) {