From aa36f63f4c478eb82ba2e7885d68deebd98e165e Mon Sep 17 00:00:00 2001 From: Sam Mousa Date: Wed, 3 Feb 2016 13:55:32 +0100 Subject: [PATCH] Fixed issue #7674 --- framework/db/Connection.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/framework/db/Connection.php b/framework/db/Connection.php index 258694ac03..c9264a07a1 100644 --- a/framework/db/Connection.php +++ b/framework/db/Connection.php @@ -337,6 +337,12 @@ class Connection extends Component * @see masterConfig */ public $masters = []; + /** + * @var string the class name of the [[Command]] object. + */ + public $commandClass = 'yii\db\Command'; + + /** * @var array the configuration that should be merged with every master configuration listed in [[masters]]. * For example, @@ -618,9 +624,10 @@ class Connection extends Component */ public function createCommand($sql = null, $params = []) { - $command = new Command([ + $command = Yii::createObject([ + 'class' => $this->commandClass, 'db' => $this, - 'sql' => $sql, + 'sql' => $sql ]); return $command->bindValues($params);