Fix #18823: Rollback changes #18806 in yii\validators\ExistValidator::checkTargetRelationExistence()

This commit is contained in:
Anton
2021-08-15 16:15:14 +03:00
committed by GitHub
parent d14d65d9f4
commit b7943c6732
2 changed files with 4 additions and 2 deletions

View File

@ -4,7 +4,7 @@ Yii Framework 2 Change Log
2.0.44 under development
------------------------
- Chg #18823: Rollback changes #18806 in `yii\validators\ExistValidator::checkTargetRelationExistence()` (WinterSilence)
- Enh #18826: Add ability to turn the sorting off for a clicked column in GridView with multisort (ditibal)
- Bug #18646: Remove stale identity data from session if `IdentityInterface::findIdentity()` returns `null` (mikehaertl)
- Bug #18832: Fix `Inflector::camel2words()` adding extra spaces (brandonkelly)

View File

@ -133,7 +133,9 @@ class ExistValidator extends Validator
$connection = $model::getDb();
if ($this->forceMasterDb && method_exists($connection, 'useMaster')) {
$exists = $connection->useMaster([$relationQuery, 'exists']);
$exists = $connection->useMaster(function() use ($relationQuery) {
return $relationQuery->exists();
});
} else {
$exists = $relationQuery->exists();
}