mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-15 13:58:24 +08:00
Refactoring
This commit is contained in:
@@ -93,12 +93,14 @@ class ExistValidator extends Validator
|
||||
$query = $this->createQuery($targetClass, $params);
|
||||
|
||||
if (is_array($object->$attribute)) {
|
||||
if ($query->count() !== count($object->$attribute)) {
|
||||
$this->addError($object, $attribute, $this->message);
|
||||
if ($query->count() === count($object->$attribute)) {
|
||||
return;
|
||||
}
|
||||
} elseif (!$query->exists()) {
|
||||
$this->addError($object, $attribute, $this->message);
|
||||
} elseif ($query->exists()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->addError($object, $attribute, $this->message);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user