modify
This commit is contained in:
+26
-13
@@ -407,24 +407,37 @@ class Loader extends BaseObject
|
|||||||
foreach ($annotations['target'] ?? [] as $value) {
|
foreach ($annotations['target'] ?? [] as $value) {
|
||||||
$value->execute([$class]);
|
$value->execute([$class]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$isGet = $annotations instanceof Get;
|
|
||||||
$isSet = $annotations instanceof Set;
|
|
||||||
$isRelate = $annotations instanceof Relation;
|
|
||||||
foreach ($annotations['methods'] as $name => $attribute) {
|
foreach ($annotations['methods'] as $name => $attribute) {
|
||||||
foreach ($attribute as $value) {
|
foreach ($attribute as $value) {
|
||||||
if ($isGet) {
|
$this->_execute($class, $annotation, $annotations, $value, $name);
|
||||||
$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]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess
|
|||||||
} else {
|
} else {
|
||||||
$this->_relation = Context::getContext(Relation::class);
|
$this->_relation = Context::getContext(Relation::class);
|
||||||
}
|
}
|
||||||
$this->createAnnotation();
|
// $this->createAnnotation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user