This commit is contained in:
2023-08-16 00:39:55 +08:00
parent a95f2af9ed
commit 0267b9ca11
+11 -7
View File
@@ -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);
}