Skip to content

Commit

Permalink
up fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kiss291323003 committed Jun 9, 2020
1 parent cbe1c1e commit 79f6ebd
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/AnnotationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ public function __construct(?Annotation $annotation = null)
$this->methodAnnotations[$name] = $ret;
}
}
//单独获取一次onRequest注解并加入
$ref = new \ReflectionClass(static::class);
$ret = $this->annotation->getAnnotation($ref->getMethod('onRequest'));
if(!empty($ret)){
$this->methodAnnotations['onRequest'] = $ret;
}

foreach ($this->getPropertyReflections() as $name => $reflection){
$ret = $this->annotation->getAnnotation($reflection);
if(!empty($ret)){
Expand Down Expand Up @@ -132,7 +139,8 @@ protected function __exec()
$allowMethodReflections = $this->getAllowMethodReflections();
$forwardPath = null;
try {
$ret = call_user_func([$this,'onRequest'],$actionName,...$this->__handleAnnotationParams('onRequest'));
$onRequestArgs = $this->__handleAnnotationParams('onRequest');
$ret = call_user_func([$this,'onRequest'],$actionName,...array_values($onRequestArgs));
if ($ret !== false) {
if (isset($allowMethodReflections[$actionName])) {
$actionArgs = $this->__handleAnnotationParams($actionName);
Expand Down

0 comments on commit 79f6ebd

Please sign in to comment.