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

@ -63,7 +63,6 @@ Yii Framework 2 Change Log
- Enh #7820: Add `or` relation for `targetAttribute` in `yii\validators\UniqueValidator` (developeruz)
- Enh #9053: Added`yii\grid\RadioButtonColumn` (darwinisgod)
- Enh #9162: Added support of closures in `value` for attributes in `yii\widgets\DetailView` (arogachev)
- Enh #10896: Select only primary key when counting records in UniqueValidator (developeruz)
- Enh #10970: Allow omit specifying empty default params on URL creation (rob006)
- Enh #11037: `yii.js` and `yii.validation.js` use `Regexp.test()` instead of `String.match()` (arogachev, nkovacs)
- Enh #11163: Added separate method for client-side validation options `yii\validators\Validator::getClientOptions()` (arogachev)
@ -118,6 +117,7 @@ Yii Framework 2 Change Log
- Bug #12599: Fixed MSSQL fail to work with `nvarbinary`. Enhanced SQL scripts compatibility with older versions (samdark)
- Enh #7435: Added `EVENT_BEFORE_RUN`, `EVENT_AFTER_RUN` and corresponding methods to `yii\base\Widget` (petrabarus)
2.0.10 October 20, 2016
-----------------------

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);