This commit is contained in:
2021-07-13 16:35:57 +08:00
parent 71503fbdcc
commit 52bc8eef02
+5
View File
@@ -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);