From 68fd2746fde810330d30a5e794200d587fb27534 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Wed, 24 Mar 2021 17:12:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Database/Base/BaseActiveRecord.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Database/Base/BaseActiveRecord.php b/Database/Base/BaseActiveRecord.php index bdd4e75f..7b82bb7f 100644 --- a/Database/Base/BaseActiveRecord.php +++ b/Database/Base/BaseActiveRecord.php @@ -26,6 +26,7 @@ use Database\HasOne; use Database\Mysql\Columns; use Database\Relation; use Exception; +use Snowflake\Abstracts\TraitApplication; use Snowflake\Exception\ComponentException; use Snowflake\Exception\NotFindClassException; use validator\Validator; @@ -45,6 +46,10 @@ use Snowflake\Event as SEvent; abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess { + + use TraitApplication; + + const AFTER_SAVE = 'after::save'; const BEFORE_SAVE = 'before::save'; @@ -848,6 +853,9 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess if (in_array($name, $this->_with)) { return $this->with($name); } + if (Snowflake::app()->has($name)) { + return Snowflake::app()->get($name); + } return parent::__get($name); }