Commit fe5376ff by Alexander Kochetov

Refactoring

parent 8188cc78
......@@ -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);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment