Skip to content

Commit

Permalink
Transfer driverName to parent class
Browse files Browse the repository at this point in the history
  • Loading branch information
bashkarev committed Jul 29, 2018
1 parent 6444943 commit e433379
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
22 changes: 10 additions & 12 deletions Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ class Connection extends \yii\db\Connection
* @inheritdoc
*/
public $commandClass = 'bashkarev\clickhouse\Command';
/**
* @inheritdoc
*/
public $driverName = 'clickhouse';
/**
* @var Schema
*/
Expand All @@ -42,15 +38,17 @@ class Connection extends \yii\db\Connection
*/
private $_configuration;

/**
* @inheritdoc
*/
public function init()
{
$this->setDriverName($this->driverName);
/**
* @inheritdoc
*/
public function __construct($config = [])
{
if (!isset($config['driverName'])) {
$config['driverName'] = 'clickhouse';
}

parent::init();
}
parent::__construct($config);
}

/**
* @inheritdoc
Expand Down
1 change: 1 addition & 0 deletions tests/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public function testGetDriverName()
{
$connection = $this->getConnection(false, false);
$this->assertEquals('clickhouse', $connection->driverName);
$this->assertEquals('clickhouse', $connection->getDriverName());
}

public function testQuoteValue()
Expand Down

0 comments on commit e433379

Please sign in to comment.