File tree 2 files changed +17
-8
lines changed
2 files changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -432,6 +432,13 @@ match, giving the ``page`` parameter a value of ``2``. Perfect.
432
432
| /blog/2 | blog | {page} = 2 |
433
433
+--------------------+-------+-----------------------+
434
434
435
+ .. caution ::
436
+
437
+ Of course, you can have more than one optional placeholder (e.g. ``/blog/{slug}/{page} ``),
438
+ but everything after an optional placeholder must be optional. For example,
439
+ ``/{page}/blog `` is a valid path, but ``page `` will always be required
440
+ (i.e. simply ``/blog `` will not match this route).
441
+
435
442
.. tip ::
436
443
437
444
Routes with optional parameters at the end will not match on requests
Original file line number Diff line number Diff line change @@ -453,7 +453,7 @@ by the routing system using the special ``_locale`` parameter:
453
453
454
454
contact :
455
455
path : /{_locale}/contact
456
- defaults : { _controller: AcmeDemoBundle:Contact:index, _locale: en }
456
+ defaults : { _controller: AcmeDemoBundle:Contact:index }
457
457
requirements :
458
458
_locale : en|fr|de
459
459
@@ -467,7 +467,6 @@ by the routing system using the special ``_locale`` parameter:
467
467
468
468
<route id =" contact" path =" /{_locale}/contact" >
469
469
<default key =" _controller" >AcmeDemoBundle:Contact:index</default >
470
- <default key =" _locale" >en</default >
471
470
<requirement key =" _locale" >en|fr|de</requirement >
472
471
</route >
473
472
</routes >
@@ -478,12 +477,15 @@ by the routing system using the special ``_locale`` parameter:
478
477
use Symfony\Component\Routing\Route;
479
478
480
479
$collection = new RouteCollection();
481
- $collection->add('contact', new Route('/{_locale}/contact', array(
482
- '_controller' => 'AcmeDemoBundle:Contact:index',
483
- '_locale' => 'en',
484
- ), array(
485
- '_locale' => 'en|fr|de',
486
- )));
480
+ $collection->add('contact', new Route(
481
+ '/{_locale}/contact',
482
+ array(
483
+ '_controller' => 'AcmeDemoBundle:Contact:index',
484
+ ),
485
+ array(
486
+ '_locale' => 'en|fr|de',
487
+ )
488
+ ));
487
489
488
490
return $collection;
489
491
You can’t perform that action at this time.
0 commit comments