From a7449ff2b6d782ffc2b227a30c59e9eb698bce1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yusuf=20=C3=96zdemir?= Date: Tue, 11 Jun 2024 20:27:51 +0300 Subject: [PATCH] add dbgroup option to CI4 Adapter --- src/DB/Codeigniter4Adapter.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/DB/Codeigniter4Adapter.php b/src/DB/Codeigniter4Adapter.php index eb2fe22..7b1fcd9 100644 --- a/src/DB/Codeigniter4Adapter.php +++ b/src/DB/Codeigniter4Adapter.php @@ -17,11 +17,14 @@ class Codeigniter4Adapter extends DBAdapter protected $db; /** - * @var $config + * @var array */ + protected $config; + public function __construct($config = null) { - + $this->config = $config ?? ['DBGroup' => 'default']; + $this->config['DBGroup'] = $this->config['DBGroup'] ?? 'default'; } /** @@ -29,7 +32,7 @@ public function __construct($config = null) */ public function connect() { - $this->db = \Config\Database::connect(); + $this->db = \Config\Database::connect($this->config['DBGroup']); return $this; }