This commit is contained in:
xl
2024-11-06 21:33:36 +08:00
parent 622176c3ff
commit 528f43c7ac
+4 -3
View File
@@ -7,6 +7,7 @@ namespace Database;
use Database\Base\ActiveQueryInterface; use Database\Base\ActiveQueryInterface;
use Kiri\Abstracts\Component; use Kiri\Abstracts\Component;
use Kiri\Di\Context; use Kiri\Di\Context;
use Swoole\Coroutine;
/** /**
* Class Relation * Class Relation
@@ -56,7 +57,7 @@ class Relation extends Component
public function first(string $_identification): mixed public function first(string $_identification): mixed
{ {
if (!Context::exists($_identification)) { if (!Context::exists($_identification)) {
Context::set($_identification, $this->_query[$_identification]->first()); Context::set($_identification, $this->_query[$_identification]->first(), Coroutine::getuid());
} }
return Context::get($_identification); return Context::get($_identification);
} }
@@ -69,7 +70,7 @@ class Relation extends Component
public function count(string $_identification): mixed public function count(string $_identification): mixed
{ {
if (!Context::exists($_identification)) { if (!Context::exists($_identification)) {
Context::set($_identification, $this->_query[$_identification]->count()); Context::set($_identification, $this->_query[$_identification]->count(), Coroutine::getuid());
} }
return Context::get($_identification); return Context::get($_identification);
} }
@@ -83,7 +84,7 @@ class Relation extends Component
public function get(string $_identification): mixed public function get(string $_identification): mixed
{ {
if (Context::exists($_identification)) { if (Context::exists($_identification)) {
Context::set($_identification, $this->_query[$_identification]->get()); Context::set($_identification, $this->_query[$_identification]->get(), Coroutine::getuid());
} }
return Context::get($_identification); return Context::get($_identification);
} }