mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-18 07:20:18 +08:00
This commit is contained in:
@@ -106,7 +106,7 @@ class UniqueValidator extends Validator
|
|||||||
$query->andWhere($this->filter);
|
$query->andWhere($this->filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$model instanceof ActiveRecordInterface || $model->getIsNewRecord()) {
|
if (!$model instanceof ActiveRecordInterface || $model->getIsNewRecord() || $model::className() !== $targetClass) {
|
||||||
// if current $model isn't in the database yet then it's OK just to call exists()
|
// if current $model isn't in the database yet then it's OK just to call exists()
|
||||||
$exists = $query->exists();
|
$exists = $query->exists();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user