Skip to content

Commit 408f2f2

Browse files
authored
Merge pull request #274 from Kison/master
EMongoExistValidator not uses criteria parameter
2 parents 3c57ad3 + b0f95bd commit 408f2f2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

validators/EMongoExistValidator.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,12 @@ protected function validateAttribute($object, $attribute)
7474
$attributeName = $this->attributeName === null ? $attribute : $this->attributeName;
7575
$finder = EMongoDocument::model($className);
7676

77-
$criteria = array($attributeName => $this->mongoId ? new MongoId($value) : $value);
77+
$criteria = $this->criteria;
78+
$criteria[$attributeName] = $this->mongoId ? new MongoId($value) : $value;
79+
7880
if(!$finder->exists($criteria)){
7981
$message = $this->message !== null ? $this->message : Yii::t('yii', '{attribute} "{value}" is invalid.');
8082
$this->addError($object, $attribute, $message, array('{value}' => CHtml::encode($value)));
8183
}
8284
}
83-
}
85+
}

0 commit comments

Comments
 (0)