File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -133,6 +133,31 @@ suppose you want to prefix all routes in the AppBundle with ``/site`` (e.g.
133
133
The path of each route being loaded from the new routing resource will now
134
134
be prefixed with the string ``/site ``.
135
135
136
+ Prefixing the Names of Imported Routes
137
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
138
+ You have the possibility to prefix all routes names with the ``@Route `` annotation.
139
+ Add a ``name `` property to the ``@Route `` annotation of the controller class and that will be considered the prefix of all route names
140
+
141
+ .. code-block :: php
142
+ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
143
+
144
+ /**
145
+ * @Route("/blog", name="blog_")
146
+ */
147
+ class BlogController extends Controller
148
+ {
149
+ /**
150
+ * @Route("/", defaults={"page": "1"}, name="index")
151
+ * @Route("/page/{page}", name="index_paginated")
152
+ */
153
+ public function indexAction($page, $_format) { ... }
154
+
155
+ /**
156
+ * @Route("/posts/{slug}", name="post")
157
+ */
158
+ public function showAction(Post $post) { ... }
159
+ }
160
+
136
161
Adding a Host Requirement to Imported Routes
137
162
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
138
163
You can’t perform that action at this time.
0 commit comments