eee
This commit is contained in:
+5
-1
@@ -23,6 +23,7 @@ use Database\ModelInterface;
|
|||||||
use Database\Relation;
|
use Database\Relation;
|
||||||
use Database\SqlBuilder;
|
use Database\SqlBuilder;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use Kiri\Di\Context;
|
||||||
use Kiri;
|
use Kiri;
|
||||||
use Kiri\Abstracts\Component;
|
use Kiri\Abstracts\Component;
|
||||||
use ReturnTypeWillChange;
|
use ReturnTypeWillChange;
|
||||||
@@ -597,7 +598,10 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, \
|
|||||||
*/
|
*/
|
||||||
public function getRelation(): ?Relation
|
public function getRelation(): ?Relation
|
||||||
{
|
{
|
||||||
return Kiri::getDi()->get(Relation::class);
|
if (Context::exists(Relation::class)) {
|
||||||
|
return Context::get(Relation::class);
|
||||||
|
}
|
||||||
|
return Context::set(Relation::class, new Relation());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -34,7 +34,7 @@ class Relation extends Component
|
|||||||
*/
|
*/
|
||||||
public function hasIdentification(string $identification): bool
|
public function hasIdentification(string $identification): bool
|
||||||
{
|
{
|
||||||
return isset($this->_query[$identification]) && $this->_query[$identification] instanceof ActiveQuery;
|
return isset($this->_query[$identification]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user