This commit is contained in:
2021-02-23 16:01:55 +08:00
parent c54f49ed19
commit 87950f07da
2 changed files with 43 additions and 12 deletions
+17 -1
View File
@@ -108,7 +108,23 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess
} else {
$this->_relation = Context::getContext(Relation::class);
}
$this->_annotations = annotation()->getMethods(get_called_class());
$this->createAnnotation();
}
/**
* @throws ComponentException
*/
private function createAnnotation()
{
$annotation = Snowflake::app()->getAttributes();
$this->_annotations = $annotation->getMethods(get_called_class());
$lists = $annotation->getPropertyAnnotation(get_called_class());
foreach ($lists as $name => $list) {
$this->{$name} = $list;
}
}