Skip to content

Commit 8c83cce

Browse files
authored
Merge pull request #108 from n1crack/dev
add dbgroup option to CI4 Adapter
2 parents 7da8e24 + a7449ff commit 8c83cce

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/DB/Codeigniter4Adapter.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,22 @@ class Codeigniter4Adapter extends DBAdapter
1717
protected $db;
1818

1919
/**
20-
* @var $config
20+
* @var array
2121
*/
22+
protected $config;
23+
2224
public function __construct($config = null)
2325
{
24-
26+
$this->config = $config ?? ['DBGroup' => 'default'];
27+
$this->config['DBGroup'] = $this->config['DBGroup'] ?? 'default';
2528
}
2629

2730
/**
2831
* @return $this
2932
*/
3033
public function connect()
3134
{
32-
$this->db = \Config\Database::connect();
35+
$this->db = \Config\Database::connect($this->config['DBGroup']);
3336

3437
return $this;
3538
}

0 commit comments

Comments
 (0)