mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-17 14:57:23 +08:00
This commit is contained in:
@@ -106,7 +106,7 @@ class UniqueValidator extends Validator
|
||||
$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()
|
||||
$exists = $query->exists();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user