Browse Source

Merge branch 'SamMousa-feature-configurable-command-class'

tags/2.0.7
SilverFire - Dmitry Naumenko 9 years ago
parent
commit
f1e8a8f258
  1. 1
      framework/CHANGELOG.md
  2. 11
      framework/db/Connection.php

1
framework/CHANGELOG.md

@ -64,6 +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 #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)

11
framework/db/Connection.php

@ -338,6 +338,11 @@ class Connection extends Component
*/
public $masters = [];
/**
* @var string the class name of the [[Command]] object.
* @since 2.0.7
*/
public $commandClass = 'yii\db\Command';
/**
* @var array the configuration that should be merged with every master configuration listed in [[masters]].
* For example,
*
@ -353,7 +358,6 @@ class Connection extends Component
* ```
*/
public $masterConfig = [];
/**
* @var Transaction the currently active transaction
*/
@ -618,9 +622,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);

Loading…
Cancel
Save