diff --git a/Annotation/Loader.php b/Annotation/Loader.php index 8a04bf58..efcb64c8 100644 --- a/Annotation/Loader.php +++ b/Annotation/Loader.php @@ -407,24 +407,37 @@ class Loader extends BaseObject foreach ($annotations['target'] ?? [] as $value) { $value->execute([$class]); } - - $isGet = $annotations instanceof Get; - $isSet = $annotations instanceof Set; - $isRelate = $annotations instanceof Relation; foreach ($annotations['methods'] as $name => $attribute) { foreach ($attribute as $value) { - if ($isGet) { - $annotation->addGets($annotations['handler'], $value->name, $name); - } else if ($isSet) { - $annotation->addSets($annotations['handler'], $value->name, $name); - } else if ($isRelate) { - $annotation->addRelate($annotations['handler'], $value->name, $name); - } else { - $value->execute([$class, $name]); - } + $this->_execute($class, $annotation, $annotations, $value, $name); } } } } + + /** + * @param $class + * @param $annotation + * @param $annotations + * @param $value + * @param $name + */ + private function _execute($class, $annotation, $annotations, $value, $name) + { + if ($annotations instanceof Get) { + var_dump($value->name, $name); + $annotation->addGets($annotations['handler'], $value->name, $name); + } else if ($annotations instanceof Get) { + var_dump($value->name, $name); + $annotation->addSets($annotations['handler'], $value->name, $name); + } else if ($annotations instanceof Get) { + var_dump($value->name, $name); + $annotation->addRelate($annotations['handler'], $value->name, $name); + } else { + $value->execute([$class, $name]); + } + } + + } diff --git a/Database/Base/BaseActiveRecord.php b/Database/Base/BaseActiveRecord.php index d2f6461b..18927639 100644 --- a/Database/Base/BaseActiveRecord.php +++ b/Database/Base/BaseActiveRecord.php @@ -141,7 +141,7 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess } else { $this->_relation = Context::getContext(Relation::class); } - $this->createAnnotation(); +// $this->createAnnotation(); }