diff --git a/Database/Base/BaseActiveRecord.php b/Database/Base/BaseActiveRecord.php index bf9dcbe3..4a8322b7 100644 --- a/Database/Base/BaseActiveRecord.php +++ b/Database/Base/BaseActiveRecord.php @@ -126,6 +126,22 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess } + /** + * BaseActiveRecord constructor. + * @param array $config + * @throws Exception + */ + public function __construct($config = []) + { + $annotation = Snowflake::app()->getAnnotation(); + $this->_annotations[self::ANNOTATION_GET] = $annotation->getGets(static::class); + $this->_annotations[self::ANNOTATION_SET] = $annotation->getSets(static::class); + $this->_relate = $annotation->getRelateMethods(static::class); + + parent::__construct($config); + } + + /** * @throws NotFindClassException * @throws ReflectionException @@ -139,11 +155,6 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess } else { $this->_relation = Context::getContext(Relation::class); } - - $annotation = Snowflake::app()->getAnnotation(); - $this->_annotations[self::ANNOTATION_GET] = $annotation->getGets(static::class); - $this->_annotations[self::ANNOTATION_SET] = $annotation->getSets(static::class); - $this->_relate = $annotation->getRelateMethods(static::class); }