Commit fe5376ff by Alexander Kochetov

Refactoring

parent 8188cc78
...@@ -93,12 +93,14 @@ class ExistValidator extends Validator ...@@ -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);
} }
/** /**
......
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