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