Skip to content

Commit

Permalink
Merge pull request #7 from arkhamvm/patch-1
Browse files Browse the repository at this point in the history
Transfer driverName to parent class
  • Loading branch information
bashkarev authored Jul 29, 2018
2 parents 72642bb + e433379 commit 78eb024
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
18 changes: 13 additions & 5 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,6 +38,18 @@ class Connection extends \yii\db\Connection
*/
private $_configuration;

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

parent::__construct($config);
}

/**
* @inheritdoc
*/
Expand Down Expand Up @@ -149,4 +157,4 @@ public function transaction(callable $callback, $isolationLevel = null)
throw new NotSupportedException('In the clickhouse database, transactions are not supported');
}

}
}
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 78eb024

Please sign in to comment.