Commit 3e94b248 by Alexander Kochetov

ExistValidator refactoring

parent 3a0e04f3
...@@ -97,11 +97,13 @@ class ExistValidator extends Validator ...@@ -97,11 +97,13 @@ class ExistValidator extends Validator
$params = [$targetAttribute => $object->$attribute]; $params = [$targetAttribute => $object->$attribute];
} }
foreach ($params as $value) { if (!$this->allowArray) {
if (!$this->allowArray && is_array($value)) { foreach ($params as $value) {
$this->addError($object, $attribute, Yii::t('yii', '{attribute} is invalid.')); if (is_array($value)) {
$this->addError($object, $attribute, Yii::t('yii', '{attribute} is invalid.'));
return; return;
}
} }
} }
......
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