This commit is contained in:
2021-04-25 17:53:17 +08:00
parent f77788c340
commit 5e11a4f03e
+16 -5
View File
@@ -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);
}