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); }