@@ -258,8 +258,8 @@ This will make the routing put the document into the request parameters and if
258258your controller specifies a parameter called ``$contentDocument ``, it will be
259259passed this document.
260260
261- You can also use variable patterns for the URL and define requirements and
262- defaults::
261+ You can also use variable patterns for the URL and define requirements with
262+ `` setRequirement `` and defaults with `` setDefault `` ::
263263
264264 // do not forget leading slash if you want /projects/{id} and not /projects{id}
265265 $route->setVariablePattern('/{id}');
@@ -277,19 +277,24 @@ it gets chosen. Otherwise, routing checks if ``/routes/projects`` has a pattern
277277that matches. If not, the top document at ``/routes `` is checked for a matching
278278pattern.
279279
280- Of course you can also have several parameters, as with normal Symfony
281- routes. The semantics and rules for patterns, defaults and requirements are
282- exactly the same as in core routes.
280+ The semantics and rules for patterns, defaults and requirements are exactly the
281+ same as in core routes. If you have several parameters, or static bits *after *
282+ a parameter, make them part of the variable pattern::
283+
284+ $route->setVariablePattern('/{context}/item/{id}');
285+ $route->setRequirement('context', '[a-z]+');
286+ $route->setRequirement('id', '\d+');
283287
284288.. note ::
285289
286290 The ``RouteDefaultsValidator `` validates the route defaults parameters.
287291 For more information, see :ref: `bundle-routing-route-defaults-validator `.
288292
289- Your controller can expect the ``$id `` parameter as well as the ``$contentDocument ``
290- as you set a content on the route. The content could be used to define an intro
291- section that is the same for each project or other shared data. If you don't
292- need content, you can just not set it in the route document.
293+ With the above example, your controller can expect both the ``$id `` parameter
294+ as well as the ``$contentDocument `` if you set a content on the route and have
295+ a variable pattern with ``{id} ``. The content could be used to define an intro
296+ section that is the same for each id. If you don't need content, you can also
297+ omit setting a content document on the route document.
293298
294299.. _component-route-generator-and-locales :
295300
0 commit comments