diff --git a/Annotation/Annotation.php b/Annotation/Annotation.php index eac65313..f6becad3 100644 --- a/Annotation/Annotation.php +++ b/Annotation/Annotation.php @@ -184,7 +184,7 @@ class Annotation extends Component * @param string $property * @return mixed|null */ - public function getPropertyAnnotation($class, $property = ''): ?array + public function getProperty($class, $property = ''): ?array { if (is_object($class)) { $class = get_class($class); diff --git a/Database/Base/BaseActiveRecord.php b/Database/Base/BaseActiveRecord.php index 15607f99..58bacdbe 100644 --- a/Database/Base/BaseActiveRecord.php +++ b/Database/Base/BaseActiveRecord.php @@ -119,9 +119,14 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess { $annotation = Snowflake::app()->getAttributes(); - $this->_annotations = $annotation->getMethods(get_called_class()); + $name = static::class; - $lists = $annotation->getPropertyAnnotation(get_called_class()); + $this->_annotations = $annotation->getMethods($name); + + $lists = $annotation->getProperty($name); + if (empty($lists)) { + return; + } foreach ($lists as $name => $list) { $this->{$name} = $list; }