Skip to content

Commit cb2895d

Browse files
author
Jens Averkamp
committed
Fix issue #878
1 parent 350743c commit cb2895d

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

Routing/Loader/Reader/RestActionReader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,8 +535,8 @@ private function readMethodAnnotations(\ReflectionMethod $reflectionMethod, $ann
535535
*/
536536
private function addRoute(RestRouteCollection $collection, $routeName, $route, $isCollection, $isInflectable, RouteAnnotation $annotation = null)
537537
{
538-
if ($annotation) {
539-
$routeName = $routeName.$annotation->getName();
538+
if ($annotation && null !== $annotation->getName()) {
539+
$routeName = $annotation->getName();
540540
}
541541

542542
$fullRouteName = $this->namePrefix.$routeName;

Tests/Fixtures/Controller/AnnotatedConditionalUsersController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,10 @@ public function conditionalUserAction()
136136
{}
137137

138138
/**
139-
* @Link("/users1", name="_a_link_method", condition="context.getMethod() in ['LINK'] and request.headers.get('User-Agent') matches '/firefox/i'")
140-
* @Get("/users2", name="_a_get_method", condition="context.getMethod() in ['GET'] and request.headers.get('User-Agent') matches '/firefox/i'")
141-
* @Get("/users3", name="_an_other_get_method")
142-
* @Post("/users4", name="_a_post_method", condition="context.getMethod() in ['POST'] and request.headers.get('User-Agent') matches '/firefox/i'")
139+
* @Link("/users1", name="multipleget_users_a_link_method", condition="context.getMethod() in ['LINK'] and request.headers.get('User-Agent') matches '/firefox/i'")
140+
* @Get("/users2", name="multipleget_users_a_get_method", condition="context.getMethod() in ['GET'] and request.headers.get('User-Agent') matches '/firefox/i'")
141+
* @Get("/users3", name="multipleget_users_an_other_get_method")
142+
* @Post("/users4", name="multipleget_users_a_post_method", condition="context.getMethod() in ['POST'] and request.headers.get('User-Agent') matches '/firefox/i'")
143143
*
144144
*/
145145
public function multiplegetUsersAction()

Tests/Fixtures/Controller/AnnotatedUsersController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ public function customUserAction($slug)
131131
{}
132132

133133
/**
134-
* @Link("/users1", name="_a_link_method")
135-
* @Get("/users2", name="_a_get_method")
136-
* @Get("/users3", name="_an_other_get_method")
137-
* @Post("/users4", name="_a_post_method")
134+
* @Link("/users1", name="multipleget_users_a_link_method")
135+
* @Get("/users2", name="multipleget_users_a_get_method")
136+
* @Get("/users3", name="multipleget_users_an_other_get_method")
137+
* @Post("/users4", name="multipleget_users_a_post_method")
138138
*
139139
*/
140140
public function multiplegetUsersAction()

0 commit comments

Comments
 (0)