From 0267b9ca1100d65bd01f911feaabe2e0fefb15e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Wed, 16 Aug 2023 00:39:55 +0800 Subject: [PATCH] qqq --- Connection.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Connection.php b/Connection.php index e1e77c8..ecfcc17 100644 --- a/Connection.php +++ b/Connection.php @@ -62,9 +62,6 @@ class Connection extends Component private ?PDO $_pdo = null; - private Pool $connections; - - /** * @var string */ @@ -80,6 +77,15 @@ class Connection extends Component private ?Schema $_schema = null; + /** + * @param Pool $connections + */ + public function __construct(public Pool $connections) + { + parent::__construct(); + } + + /** * @return void * @throws Exception @@ -90,8 +96,6 @@ class Connection extends Component $eventProvider->on(BeginTransaction::class, [$this, 'beginTransaction'], 0); $eventProvider->on(Rollback::class, [$this, 'rollback'], 0); $eventProvider->on(Commit::class, [$this, 'commit'], 0); - - $this->connections = Kiri::getDi()->get(Pool::class); } @@ -115,7 +119,7 @@ class Connection extends Component /** * @return PDO - * @throws Kiri\Exception\ConfigException + * @throws Exception */ public function getConnection(): PDO { @@ -248,7 +252,7 @@ class Connection extends Component */ public function disconnect(): void { - $this->pool()->clean($this->cds); + $this->pool()->close($this->cds); }