From 7d574e9172f222aa5db31f78ceb88a4dc4d400ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Mon, 3 Apr 2023 11:08:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kiri-engine/Pool/Connection.php | 10 +++++----- kiri-websocket-server/Server.php | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/kiri-engine/Pool/Connection.php b/kiri-engine/Pool/Connection.php index f0e05793..0f4a77e6 100644 --- a/kiri-engine/Pool/Connection.php +++ b/kiri-engine/Pool/Connection.php @@ -45,7 +45,7 @@ class Connection extends Component */ public function inTransaction($name): bool { - $connection = Context::getContext($name); + $connection = Context::get($name); if ($connection instanceof \Database\Mysql\PDO) { return $connection->inTransaction(); } @@ -71,7 +71,7 @@ class Connection extends Component */ public function commit($coroutineName) { - $connection = Context::getContext($coroutineName); + $connection = Context::get($coroutineName); if ($connection instanceof \Database\Mysql\PDO) { $connection->commit(); } @@ -84,7 +84,7 @@ class Connection extends Component */ public function rollback($coroutineName) { - $connection = Context::getContext($coroutineName); + $connection = Context::get($coroutineName); if ($connection instanceof \Database\Mysql\PDO) { $connection->rollBack(); } @@ -195,7 +195,7 @@ class Connection extends Component */ public function release($coroutineName) { - $client = Context::getContext($coroutineName); + $client = Context::get($coroutineName); if (!($client instanceof \Database\Mysql\PDO) || $client->inTransaction()) { return; } @@ -220,7 +220,7 @@ class Connection extends Component */ private function hasClient($coroutineName): bool { - return Context::hasContext($coroutineName); + return Context::exists($coroutineName); } diff --git a/kiri-websocket-server/Server.php b/kiri-websocket-server/Server.php index 539fc85c..ce702732 100644 --- a/kiri-websocket-server/Server.php +++ b/kiri-websocket-server/Server.php @@ -135,7 +135,7 @@ class Server extends Component implements OnHandshakeInterface, OnMessageInterfa { try { /** @var \Kiri\Message\Response $psrResponse */ - $psrResponse = Context::setContext(ResponseInterface::class, new \Kiri\Message\Response()); + $psrResponse = Context::set(ResponseInterface::class, new \Kiri\Message\Response()); $handler = $this->router->find('/', 'GET'); if (is_integer($handler)) {