@@ -177,8 +177,10 @@ file:
177177 <container xmlns =" http://symfony.com/schema/dic/services"
178178 xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
179179 xmlns : framework =" http://symfony.com/schema/dic/symfony"
180- xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
181- http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
180+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
181+ http://symfony.com/schema/dic/services/services-1.0.xsd
182+ http://symfony.com/schema/dic/symfony
183+ http://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
182184
183185 <framework : config >
184186 <!-- ... -->
@@ -652,7 +654,9 @@ requirements can easily be added for each parameter. For example:
652654 // ...
653655
654656 /**
655- * @Route("/blog/{page}", defaults={"page": 1}, requirements={"page": "\d+"})
657+ * @Route("/blog/{page}", defaults={"page": 1}, requirements={
658+ * "page": "\d+"
659+ * })
656660 */
657661 public function indexAction($page)
658662 {
740744 class MainController extends Controller
741745 {
742746 /**
743- * @Route("/{_locale}", defaults={"_locale": "en"}, requirements={"_locale": "en|fr"})
747+ * @Route("/{_locale}", defaults={"_locale": "en"}, requirements={
748+ * "_locale": "en|fr"
749+ * })
744750 */
745751 public function homepageAction($_locale)
746752 {
@@ -939,8 +945,12 @@ routing system can be:
939945 /**
940946 * @Route(
941947 * "/articles/{_locale}/{year}/{title}.{_format}",
942- * defaults: {"_format": "html"}
943- * requirements: {"_locale": "en|fr", "_format": "html|rss", "year": "\d+"}
948+ * defaults: {"_format": "html"},
949+ * requirements: {
950+ * "_locale": "en|fr",
951+ * "_format": "html|rss",
952+ * "year": "\d+"
953+ * }
944954 * )
945955 */
946956 public function showAction($_locale, $year, $title)
@@ -1017,7 +1027,7 @@ a slash. URLs matching this route might look like:
10171027 This example also highlights the special ``_format `` routing parameter.
10181028 When using this parameter, the matched value becomes the "request format"
10191029 of the ``Request `` object. Ultimately, the request format is used for such
1020- things such as setting the ``Content-Type `` of the response (e.g. a ``json ``
1030+ things as setting the ``Content-Type `` of the response (e.g. a ``json ``
10211031 request format translates into a ``Content-Type `` of ``application/json ``).
10221032 It can also be used in the controller to render a different template for
10231033 each value of ``_format ``. The ``_format `` parameter is a very powerful way
@@ -1109,7 +1119,7 @@ each is made available as an argument to the controller method::
11091119
11101120 public function showAction($slug)
11111121 {
1112- // ...
1122+ // ...
11131123 }
11141124
11151125In reality, the entire ``defaults `` collection is merged with the parameter
@@ -1184,8 +1194,8 @@ configuration:
11841194
11851195 $collection = new RouteCollection();
11861196 $collection->addCollection(
1187- // second argument is the type, which is required to enable the annotation reader
1188- // for this resource
1197+ // second argument is the type, which is required to enable
1198+ // the annotation reader for this resource
11891199 $loader->import("@AppBundle/Controller/", "annotation")
11901200 );
11911201
@@ -1275,7 +1285,7 @@ suppose you want to prefix all routes in the AppBundle with ``/site`` (e.g.
12751285 // app/config/routing.php
12761286 use Symfony\Component\Routing\RouteCollection;
12771287
1278- $app = $loader->import('@AppBundle/Controller/');
1288+ $app = $loader->import('@AppBundle/Controller/', 'annotation' );
12791289 $app->addPrefix('/site');
12801290
12811291 $collection = new RouteCollection();
@@ -1361,7 +1371,9 @@ system. Take the ``blog_show`` example route from earlier::
13611371 // '_controller' => 'AppBundle:Blog:show',
13621372 // )
13631373
1364- $uri = $this->get('router')->generate('blog_show', array('slug' => 'my-blog-post'));
1374+ $uri = $this->get('router')->generate('blog_show', array(
1375+ 'slug' => 'my-blog-post'
1376+ ));
13651377 // /blog/my-blog-post
13661378
13671379To generate a URL, you need to specify the name of the route (e.g. ``blog_show ``)
@@ -1429,7 +1441,10 @@ Generating URLs with Query Strings
14291441The ``generate `` method takes an array of wildcard values to generate the URI.
14301442But if you pass extra ones, they will be added to the URI as a query string::
14311443
1432- $this->get('router')->generate('blog', array('page' => 2, 'category' => 'Symfony'));
1444+ $this->get('router')->generate('blog', array(
1445+ 'page' => 2,
1446+ 'category' => 'Symfony'
1447+ ));
14331448 // /blog/2?category=Symfony
14341449
14351450Generating URLs from a Template
@@ -1470,7 +1485,7 @@ method::
14701485
14711486From a template, in Twig, simply use the ``url() `` function (which generates an absolute URL)
14721487rather than the ``path() `` function (which generates a relative URL). In PHP, pass ``true ``
1473- to ``generateUrl () ``:
1488+ to ``generate () ``:
14741489
14751490.. configuration-block ::
14761491
0 commit comments