改名
This commit is contained in:
@@ -34,6 +34,9 @@ class Annotation extends Component
|
|||||||
private array $_methods = [];
|
private array $_methods = [];
|
||||||
|
|
||||||
|
|
||||||
|
private array $_prepertyes = [];
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $handler
|
* @param array $handler
|
||||||
* @param $name
|
* @param $name
|
||||||
@@ -147,6 +150,9 @@ 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)])) {
|
||||||
|
$this->_prepertyes[get_class($object)] = [];
|
||||||
|
}
|
||||||
foreach ($property as $value) {
|
foreach ($property as $value) {
|
||||||
if ($value->isStatic()) continue;
|
if ($value->isStatic()) continue;
|
||||||
$attributes = $value->getAttributes();
|
$attributes = $value->getAttributes();
|
||||||
@@ -160,6 +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;
|
||||||
if ($value->isPublic()) {
|
if ($value->isPublic()) {
|
||||||
$object->{$value->getName()} = $annotation;
|
$object->{$value->getName()} = $annotation;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ use Snowflake\Application;
|
|||||||
use Snowflake\Event;
|
use Snowflake\Event;
|
||||||
use Snowflake\Exception\ComponentException;
|
use Snowflake\Exception\ComponentException;
|
||||||
use Snowflake\Exception\ConfigException;
|
use Snowflake\Exception\ConfigException;
|
||||||
|
use Snowflake\Exception\NotFindClassException;
|
||||||
|
use Snowflake\Exception\NotFindPropertyException;
|
||||||
use Snowflake\Snowflake;
|
use Snowflake\Snowflake;
|
||||||
use Snowflake\Abstracts\Config;
|
use Snowflake\Abstracts\Config;
|
||||||
|
|
||||||
@@ -36,12 +38,15 @@ class DatabasesProviders extends Providers
|
|||||||
$event->on(Event::SERVER_TASK_START, [$this, 'createPool']);
|
$event->on(Event::SERVER_TASK_START, [$this, 'createPool']);
|
||||||
|
|
||||||
$event->on(Event::SERVER_WORKER_START, [$this, 'scanModel']);
|
$event->on(Event::SERVER_WORKER_START, [$this, 'scanModel']);
|
||||||
|
$event->on(Event::SERVER_TASK_START, [$this, 'scanModel']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws ReflectionException
|
|
||||||
* @throws ComponentException
|
* @throws ComponentException
|
||||||
|
* @throws ReflectionException
|
||||||
|
* @throws NotFindClassException
|
||||||
|
* @throws NotFindPropertyException
|
||||||
*/
|
*/
|
||||||
public function scanModel()
|
public function scanModel()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user