Fixes #13453: Reverted #10896 commit 729ddc5b76e8159d051e9c5783f5534eeb212efb

It was causing side effects: https://github.com/yiisoft/yii2/issues/13453
This commit is contained in:
Alexander Makarov
2017-01-28 01:13:22 +03:00
parent be4ebdd049
commit bede9feba5
2 changed files with 2 additions and 2 deletions

View File

@ -161,7 +161,7 @@ class UniqueValidator extends Validator
} else {
// if current $model is in the database already we can't use exists()
/** @var $models ActiveRecordInterface[] */
$models = $query->select($targetClass::primaryKey())->limit(2)->all();
$models = $query->limit(2)->all();
$n = count($models);
if ($n === 1) {
$keys = array_keys($conditions);