diff --git a/Database/Base/BaseActiveRecord.php b/Database/Base/BaseActiveRecord.php index 8fe0415d..2ab47cda 100644 --- a/Database/Base/BaseActiveRecord.php +++ b/Database/Base/BaseActiveRecord.php @@ -28,6 +28,7 @@ use ReflectionException; use Snowflake\Abstracts\Component; use Snowflake\Abstracts\Config; use Snowflake\Abstracts\TraitApplication; +use Snowflake\Application; use Snowflake\Exception\ConfigException; use Snowflake\Exception\NotFindClassException; use Snowflake\Snowflake; @@ -73,6 +74,9 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess private array $_annotations = []; + protected ?Application $container; + + /** * @var bool */ @@ -125,6 +129,7 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess */ public function init() { + $this->container = Snowflake::app(); if (!Context::hasContext(Relation::class)) { $relation = Snowflake::createObject(Relation::class); $this->_relation = Context::setContext(Relation::class, $relation);