use getTargetClass in function checkTargetAttributeExistence

This interesting change, to be able to change getTargetClass when necessary when extending this class.
This commit is contained in:
RodrigoDornelles
2021-06-15 13:07:53 -03:00
committed by GitHub
parent 3e9599aba2
commit e1e7ea37d5

View File

@ -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)) {