This commit is contained in:
2023-04-03 11:08:11 +08:00
parent 709e35f4dc
commit 7d574e9172
2 changed files with 6 additions and 6 deletions
+5 -5
View File
@@ -45,7 +45,7 @@ class Connection extends Component
*/ */
public function inTransaction($name): bool public function inTransaction($name): bool
{ {
$connection = Context::getContext($name); $connection = Context::get($name);
if ($connection instanceof \Database\Mysql\PDO) { if ($connection instanceof \Database\Mysql\PDO) {
return $connection->inTransaction(); return $connection->inTransaction();
} }
@@ -71,7 +71,7 @@ class Connection extends Component
*/ */
public function commit($coroutineName) public function commit($coroutineName)
{ {
$connection = Context::getContext($coroutineName); $connection = Context::get($coroutineName);
if ($connection instanceof \Database\Mysql\PDO) { if ($connection instanceof \Database\Mysql\PDO) {
$connection->commit(); $connection->commit();
} }
@@ -84,7 +84,7 @@ class Connection extends Component
*/ */
public function rollback($coroutineName) public function rollback($coroutineName)
{ {
$connection = Context::getContext($coroutineName); $connection = Context::get($coroutineName);
if ($connection instanceof \Database\Mysql\PDO) { if ($connection instanceof \Database\Mysql\PDO) {
$connection->rollBack(); $connection->rollBack();
} }
@@ -195,7 +195,7 @@ class Connection extends Component
*/ */
public function release($coroutineName) public function release($coroutineName)
{ {
$client = Context::getContext($coroutineName); $client = Context::get($coroutineName);
if (!($client instanceof \Database\Mysql\PDO) || $client->inTransaction()) { if (!($client instanceof \Database\Mysql\PDO) || $client->inTransaction()) {
return; return;
} }
@@ -220,7 +220,7 @@ class Connection extends Component
*/ */
private function hasClient($coroutineName): bool private function hasClient($coroutineName): bool
{ {
return Context::hasContext($coroutineName); return Context::exists($coroutineName);
} }
+1 -1
View File
@@ -135,7 +135,7 @@ class Server extends Component implements OnHandshakeInterface, OnMessageInterfa
{ {
try { try {
/** @var \Kiri\Message\Response $psrResponse */ /** @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'); $handler = $this->router->find('/', 'GET');
if (is_integer($handler)) { if (is_integer($handler)) {