From b43ebcc368e5da2caed418a2a976cf847051780c Mon Sep 17 00:00:00 2001 From: SilverFire - Dmitry Naumenko Date: Thu, 4 Feb 2016 14:23:42 +0200 Subject: [PATCH] yii\db\Connection::createCommand() removed DI usage for performance reasons --- framework/CHANGELOG.md | 2 +- framework/db/Connection.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index ad43819332..aa53bc4e65 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -64,7 +64,7 @@ Yii Framework 2 Change Log - Enh #7405: Added `yii\filters\auth\AuthMethod::optional` for optional authentification in all child classes (SilverFire) - Enh #7566: Improved `\yii\validators\CompareValidator` default messages (slinstj) - Enh #7581: Added ability to specify range using anonymous function in `RangeValidator` (RomeroMsk) -- Enh #7674: Added `yii\db\Connection::commandClass` to configure a command class that will be used by the connection (sammousa, silverfire) +- Enh #7674: Added `yii\db\Connection::commandClass` to configure a command class that will be used by the connection (sammousa, silverfire, cebe) - Enh #8284: Added `\yii\captcha\CaptchaAction::$imageLibrary` property allowing to set image rendering library (AnatolyRugalev) - Enh #8329: Added support of options for `message` console command (vchenin) - Enh #8613: `yii\widgets\FragmentCache` will not store empty content anymore which fixes some problems related to `yii\filters\PageCache` (kidol) diff --git a/framework/db/Connection.php b/framework/db/Connection.php index 9adc2adf4e..aa80b54070 100644 --- a/framework/db/Connection.php +++ b/framework/db/Connection.php @@ -626,10 +626,10 @@ class Connection extends Component */ public function createCommand($sql = null, $params = []) { - $command = Yii::createObject([ - 'class' => $this->commandClass, + /** @var Command $command */ + $command = new $this->commandClass([ 'db' => $this, - 'sql' => $sql + 'sql' => $sql, ]); return $command->bindValues($params);