modify
This commit is contained in:
@@ -179,7 +179,7 @@ class Loader extends BaseObject
|
|||||||
}
|
}
|
||||||
$this->appendFileToDirectory($path->getRealPath(), $replace->getName());
|
$this->appendFileToDirectory($path->getRealPath(), $replace->getName());
|
||||||
|
|
||||||
$_array = ['handler' => $replace->getName(), 'target' => [], 'methods' => [], 'property' => []];
|
$_array = ['handler' => $replace->newInstance(), 'target' => [], 'methods' => [], 'property' => []];
|
||||||
foreach ($replace->getAttributes() as $attribute) {
|
foreach ($replace->getAttributes() as $attribute) {
|
||||||
if ($attribute->getName() == Attribute::class) {
|
if ($attribute->getName() == Attribute::class) {
|
||||||
continue;
|
continue;
|
||||||
@@ -401,22 +401,21 @@ class Loader extends BaseObject
|
|||||||
if ($annotations === null) {
|
if ($annotations === null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$target = new $annotations['handler']();
|
|
||||||
foreach ($annotations['target'] ?? [] as $value) {
|
foreach ($annotations['target'] ?? [] as $value) {
|
||||||
$value->execute([$target]);
|
$value->execute([$annotations['handler']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$_className = $annotations['handler']::class;
|
||||||
foreach ($annotations['methods'] as $name => $attribute) {
|
foreach ($annotations['methods'] as $name => $attribute) {
|
||||||
foreach ($attribute as $value) {
|
foreach ($attribute as $value) {
|
||||||
if ($value instanceof Relation) {
|
if ($value instanceof Relation) {
|
||||||
$annotation->addRelate($target::class, $value->name, $name);
|
$annotation->addRelate($_className, $value->name, $name);
|
||||||
} else if ($value instanceof Get) {
|
} else if ($value instanceof Get) {
|
||||||
$annotation->addGets($target::class, $value->name, $name);
|
$annotation->addGets($_className, $value->name, $name);
|
||||||
} else if ($value instanceof Set) {
|
} else if ($value instanceof Set) {
|
||||||
$annotation->addSets($target::class, $value->name, $name);
|
$annotation->addSets($_className, $value->name, $name);
|
||||||
} else {
|
} else {
|
||||||
$value->execute([$target, $name]);
|
$value->execute([$annotations['handler'], $name]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user