Refactoring

This commit is contained in:
Alexander Kochetov
2014-05-08 20:16:48 +04:00
parent 8188cc78d3
commit fe5376ff7d

View File

@@ -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);
} }
/** /**