Skip to content

Commit

Permalink
Fix bug yiisoft#10638
Browse files Browse the repository at this point in the history
  • Loading branch information
githubjeka committed Jan 21, 2016
1 parent 3ebe092 commit 2e7014f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion framework/validators/UniqueValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function validateAttribute($model, $attribute)
$query->andWhere($this->filter);
}

if (!$model instanceof ActiveRecordInterface || $model->getIsNewRecord() || $model->className() !== $targetClass) {
if (!$model instanceof ActiveRecordInterface || $model->getIsNewRecord() || $model->className() !== $targetClass::className()) {
// if current $model isn't in the database yet then it's OK just to call exists()
// also there's no need to run check based on primary keys, when $targetClass is not the same as $model's class
$exists = $query->exists();
Expand Down

0 comments on commit 2e7014f

Please sign in to comment.