diff --git a/Annotation/Loader.php b/Annotation/Loader.php index 4dca8ea3..e80c75f5 100644 --- a/Annotation/Loader.php +++ b/Annotation/Loader.php @@ -185,7 +185,12 @@ class Loader extends BaseObject if (!class_exists($attribute->getName())) { continue; } - $_property[] = $attribute->newInstance(); + $property = $attribute->newInstance(); + if ($property instanceof Inject) { + $property->execute([$_array['handler'], $method->getName()]); + } else { + $_property[] = $attribute->newInstance(); + } } $_array['property'][$method->getName()] = $_property; } diff --git a/Annotation/Rpc/RpcService.php b/Annotation/Rpc/RpcService.php index e49e9c2c..778e393c 100644 --- a/Annotation/Rpc/RpcService.php +++ b/Annotation/Rpc/RpcService.php @@ -56,9 +56,6 @@ use Snowflake\Snowflake; $rpc = Snowflake::app()->getRpc(); $rpc->addProducer($this->cmd, $handler, $this->config); - $attributes = Snowflake::app()->getAttributes(); - $attributes->injectProperty($handler[0]); - return parent::execute($handler); } diff --git a/Database/Base/BaseActiveRecord.php b/Database/Base/BaseActiveRecord.php index 7910cfc7..d26cfa8d 100644 --- a/Database/Base/BaseActiveRecord.php +++ b/Database/Base/BaseActiveRecord.php @@ -149,8 +149,6 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess private function createAnnotation() { $annotation = Snowflake::app()->getAttributes(); - $annotation->injectProperty($this); - $methods = $annotation->getMethods(get_called_class()); foreach ($methods as $method => $attributes) { foreach ($attributes as $attribute) {