This commit is contained in:
as2252258@163.com
2021-04-24 20:23:28 +08:00
parent 399f2e457c
commit 63741bacbb
+3 -4
View File
@@ -181,7 +181,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;
@@ -403,13 +403,12 @@ class Loader extends BaseObject
if ($annotations === null) { if ($annotations === null) {
continue; continue;
} }
$class = Snowflake::createObject($annotations['handler']);
foreach ($annotations['target'] ?? [] as $value) { foreach ($annotations['target'] ?? [] as $value) {
$value->execute([$class]); $value->execute([$annotations['handler']]);
} }
foreach ($annotations['methods'] as $name => $attribute) { foreach ($annotations['methods'] as $name => $attribute) {
foreach ($attribute as $value) { foreach ($attribute as $value) {
$value->execute([$class, $name]); $value->execute([$annotations['handler'], $name]);
// //
// if ($value instanceof Relation) { // if ($value instanceof Relation) {
// $annotation->addRelate($annotations['handler'], $value->name, $name); // $annotation->addRelate($annotations['handler'], $value->name, $name);