swoft-cloud / swoft

🚀 PHP Microservice Full Coroutine Framework
https://swoft.org
Apache License 2.0
5.58k stars 788 forks source link

路由注解加name属性,在获取route对象时得不到name值 #1202

Closed burugo closed 4 years ago

burugo commented 4 years ago
Q A
Bug report? yes
Feature request? yes
Swoft version 2.0.7 (by php bin/swoft -V)
Swoole version 4.4.8 (by php --ri swoole)
PHP version 7.3.11 (by php -v)
Runtime environment Win10/Mac/CentOS 7/Ubuntu/Docker etc.

Describe the bug RequestMapping注解的name属性无效

Details

路由注解加name属性,在获取route对象时得不到name值 打印出来是空字符串 已经提交了pr https://github.com/swoft-cloud/swoft-component/pull/559

Provide minimal script to reproduce the issue

 /**
   *@RequestMapping(method={RequestMethod::GET},name="get.route.test")
   */
public function show(Request $request){
    $route = $request->getAttribute(Request::ROUTER_ATTRIBUTE)[2];
    $routeName = $route->getName();
    vdump($routeName);
}
inhere commented 4 years ago

hi @burugo

不能直接向组件仓库提交PR, 参考这里 swoft-cloud/swoft#829

burugo commented 4 years ago

hi @burugo

不能直接向组件仓库提交PR, 参考这里 #829

已更改pr地址