File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -52,5 +52,48 @@ For a full list of annotations check out FOS/RestBundle/Controller/Annotations
5252 * PUT Route annotation.
5353 * @Put("/likes/{type}/{typeId}")
5454 */
55+
56+ ## Method Name Prefix
57+
58+ By default, the routing name defined by the annotation is appended to the generated routing name.
59+
60+ Example:
61+ ``` php
62+ use FOS\RestBundle\Controller\Annotations\Get
63+
64+ /**
65+ * @Get("/users/foo", name="_foo")
66+ * @Get("/users/bar", name="_bar")
67+ */
68+ public function getUsers() { /** */ }
69+ ```
70+
71+ Result:
72+ ```
73+ Name Method Scheme Host Path
74+ get_users_foo GET ANY ANY /users/foo.{_format}
75+ get_users_bar GET ANY ANY /users/bar.{_format}
76+ ```
77+
78+
79+ You can add the "method_prefix" option to change this behavior.
80+
81+ Example:
82+ ``` php
83+ use FOS\RestBundle\Controller\Annotations\Get
84+
85+ /**
86+ * @Get("/users/foo", name="get_foo", options={ "method_prefix" = false })
87+ * @Get("/users/bar", name="get_bar", options={ "method_prefix" = false })
88+ */
89+ public function getUsers() { /** */ }
90+ ```
91+
92+ Result:
93+ ```
94+ Name Method Scheme Host Path
95+ get_foo GET ANY ANY /users/foo.{_format}
96+ get_bar GET ANY ANY /users/bar.{_format}
97+ ```
5598
5699[ Return to the index] ( index.md ) or continue with the [ Full default configuration] ( configuration-reference.md ) .
You can’t perform that action at this time.
0 commit comments