mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-15 13:58:24 +08:00
ExistValidator refactoring
This commit is contained in:
@@ -97,11 +97,13 @@ class ExistValidator extends Validator
|
||||
$params = [$targetAttribute => $object->$attribute];
|
||||
}
|
||||
|
||||
foreach ($params as $value) {
|
||||
if (!$this->allowArray && is_array($value)) {
|
||||
$this->addError($object, $attribute, Yii::t('yii', '{attribute} is invalid.'));
|
||||
if (!$this->allowArray) {
|
||||
foreach ($params as $value) {
|
||||
if (is_array($value)) {
|
||||
$this->addError($object, $attribute, Yii::t('yii', '{attribute} is invalid.'));
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user