This commit is contained in:
2021-02-23 16:39:27 +08:00
parent 3a2c2aca6b
commit 3cef44886d
2 changed files with 7 additions and 8 deletions
+7 -7
View File
@@ -34,7 +34,7 @@ class Annotation extends Component
private array $_methods = []; private array $_methods = [];
private array $_prepertyes = []; private array $_properties = [];
/** /**
@@ -150,8 +150,8 @@ class Annotation extends Component
private function resolveProperty(ReflectionClass $reflectionClass, $object) private function resolveProperty(ReflectionClass $reflectionClass, $object)
{ {
$property = $reflectionClass->getProperties(); $property = $reflectionClass->getProperties();
if (!isset($this->_prepertyes[get_class($object)])) { if (!isset($this->_properties[get_class($object)])) {
$this->_prepertyes[get_class($object)] = []; $this->_properties[get_class($object)] = [];
} }
foreach ($property as $value) { foreach ($property as $value) {
if ($value->isStatic()) continue; if ($value->isStatic()) continue;
@@ -166,7 +166,7 @@ class Annotation extends Component
continue; continue;
} }
$annotation = $annotation->execute([$object, $value->getName()]); $annotation = $annotation->execute([$object, $value->getName()]);
$this->_prepertyes[get_class($object)][$value->getName()] = $annotation; $this->_properties[get_class($object)][$value->getName()] = $annotation;
if ($value->isPublic()) { if ($value->isPublic()) {
continue; continue;
@@ -189,15 +189,15 @@ class Annotation extends Component
if (is_object($class)) { if (is_object($class)) {
$class = get_class($class); $class = get_class($class);
} }
if (!isset($this->_prepertyes[$class])) { if (!isset($this->_properties[$class])) {
return null; return null;
} }
if (!empty($property)) { if (!empty($property)) {
return $this->_prepertyes[$class][$property] ?? null; return $this->_properties[$class][$property] ?? null;
} }
return $this->_prepertyes[$class]; return $this->_properties[$class];
} }
-1
View File
@@ -37,7 +37,6 @@ class DatabasesProviders extends Providers
$event->on(Event::SERVER_WORKER_START, [$this, 'createPool']); $event->on(Event::SERVER_WORKER_START, [$this, 'createPool']);
$event->on(Event::SERVER_TASK_START, [$this, 'createPool']); $event->on(Event::SERVER_TASK_START, [$this, 'createPool']);
$event->on(Event::SERVER_BEFORE_START, [$this, 'scanModel']);
$event->on(Event::SERVER_WORKER_START, [$this, 'scanModel']); $event->on(Event::SERVER_WORKER_START, [$this, 'scanModel']);
$event->on(Event::SERVER_TASK_START, [$this, 'scanModel']); $event->on(Event::SERVER_TASK_START, [$this, 'scanModel']);
} }