Skip to content

Commit 78eb024

Browse files
authored
Merge pull request #7 from arkhamvm/patch-1
Transfer driverName to parent class
2 parents 72642bb + e433379 commit 78eb024

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

Connection.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ class Connection extends \yii\db\Connection
2525
* @inheritdoc
2626
*/
2727
public $commandClass = 'bashkarev\clickhouse\Command';
28-
/**
29-
* @inheritdoc
30-
*/
31-
public $driverName = 'clickhouse';
3228
/**
3329
* @var Schema
3430
*/
@@ -42,6 +38,18 @@ class Connection extends \yii\db\Connection
4238
*/
4339
private $_configuration;
4440

41+
/**
42+
* @inheritdoc
43+
*/
44+
public function __construct($config = [])
45+
{
46+
if (!isset($config['driverName'])) {
47+
$config['driverName'] = 'clickhouse';
48+
}
49+
50+
parent::__construct($config);
51+
}
52+
4553
/**
4654
* @inheritdoc
4755
*/
@@ -149,4 +157,4 @@ public function transaction(callable $callback, $isolationLevel = null)
149157
throw new NotSupportedException('In the clickhouse database, transactions are not supported');
150158
}
151159

152-
}
160+
}

tests/ConnectionTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public function testGetDriverName()
5959
{
6060
$connection = $this->getConnection(false, false);
6161
$this->assertEquals('clickhouse', $connection->driverName);
62+
$this->assertEquals('clickhouse', $connection->getDriverName());
6263
}
6364

6465
public function testQuoteValue()

0 commit comments

Comments
 (0)