@@ -173,8 +173,10 @@ file:
173173 <container xmlns =" http://symfony.com/schema/dic/services"
174174 xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
175175 xmlns : framework =" http://symfony.com/schema/dic/symfony"
176- xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
177- http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
176+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
177+ http://symfony.com/schema/dic/services/services-1.0.xsd
178+ http://symfony.com/schema/dic/symfony
179+ http://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
178180
179181 <framework : config >
180182 <!-- ... -->
@@ -649,7 +651,9 @@ be added for each parameter. For example:
649651 // ...
650652
651653 /**
652- * @Route("/blog/{page}", defaults={"page": 1}, requirements={"page": "\d+"})
654+ * @Route("/blog/{page}", defaults={"page": 1}, requirements={
655+ * "page": "\d+"
656+ * })
653657 */
654658 public function indexAction($page)
655659 {
737741 class MainController extends Controller
738742 {
739743 /**
740- * @Route("/{_locale}", defaults={"_locale": "en"}, requirements={"_locale": "en|fr"})
744+ * @Route("/{_locale}", defaults={"_locale": "en"}, requirements={
745+ * "_locale": "en|fr"
746+ * })
741747 */
742748 public function homepageAction($_locale)
743749 {
@@ -1018,8 +1024,12 @@ routing system can be:
10181024 /**
10191025 * @Route(
10201026 * "/articles/{_locale}/{year}/{title}.{_format}",
1021- * defaults: {"_format": "html"}
1022- * requirements: {"_locale": "en|fr", "_format": "html|rss", "year": "\d+"}
1027+ * defaults: {"_format": "html"},
1028+ * requirements: {
1029+ * "_locale": "en|fr",
1030+ * "_format": "html|rss",
1031+ * "year": "\d+"
1032+ * }
10231033 * )
10241034 */
10251035 public function showAction($_locale, $year, $title)
@@ -1096,7 +1106,7 @@ a slash. URLs matching this route might look like:
10961106 This example also highlights the special ``_format `` routing parameter.
10971107 When using this parameter, the matched value becomes the "request format"
10981108 of the ``Request `` object. Ultimately, the request format is used for such
1099- things such as setting the ``Content-Type `` of the response (e.g. a ``json ``
1109+ things as setting the ``Content-Type `` of the response (e.g. a ``json ``
11001110 request format translates into a ``Content-Type `` of ``application/json ``).
11011111 It can also be used in the controller to render a different template for
11021112 each value of ``_format ``. The ``_format `` parameter is a very powerful way
@@ -1188,7 +1198,7 @@ each is made available as an argument to the controller method::
11881198
11891199 public function showAction($slug)
11901200 {
1191- // ...
1201+ // ...
11921202 }
11931203
11941204In reality, the entire ``defaults `` collection is merged with the parameter
@@ -1263,8 +1273,8 @@ configuration:
12631273
12641274 $collection = new RouteCollection();
12651275 $collection->addCollection(
1266- // second argument is the type, which is required to enable the annotation reader
1267- // for this resource
1276+ // second argument is the type, which is required to enable
1277+ // the annotation reader for this resource
12681278 $loader->import("@AppBundle/Controller/", "annotation")
12691279 );
12701280
@@ -1354,7 +1364,7 @@ suppose you want to prefix all routes in the AppBundle with ``/site`` (e.g.
13541364 // app/config/routing.php
13551365 use Symfony\Component\Routing\RouteCollection;
13561366
1357- $app = $loader->import('@AppBundle/Controller/');
1367+ $app = $loader->import('@AppBundle/Controller/', 'annotation' );
13581368 $app->addPrefix('/site');
13591369
13601370 $collection = new RouteCollection();
@@ -1437,7 +1447,9 @@ system. Take the ``blog_show`` example route from earlier::
14371447 // '_controller' => 'AppBundle:Blog:show',
14381448 // )
14391449
1440- $uri = $this->get('router')->generate('blog_show', array('slug' => 'my-blog-post'));
1450+ $uri = $this->get('router')->generate('blog_show', array(
1451+ 'slug' => 'my-blog-post'
1452+ ));
14411453 // /blog/my-blog-post
14421454
14431455To generate a URL, you need to specify the name of the route (e.g. ``blog_show ``)
@@ -1505,7 +1517,10 @@ Generating URLs with Query Strings
15051517The ``generate `` method takes an array of wildcard values to generate the URI.
15061518But if you pass extra ones, they will be added to the URI as a query string::
15071519
1508- $this->get('router')->generate('blog', array('page' => 2, 'category' => 'Symfony'));
1520+ $this->get('router')->generate('blog', array(
1521+ 'page' => 2,
1522+ 'category' => 'Symfony'
1523+ ));
15091524 // /blog/2?category=Symfony
15101525
15111526Generating URLs from a Template
@@ -1546,7 +1561,7 @@ method::
15461561
15471562From a template, in Twig, simply use the ``url() `` function (which generates an absolute URL)
15481563rather than the ``path() `` function (which generates a relative URL). In PHP, pass ``true ``
1549- to ``generateUrl () ``:
1564+ to ``generate () ``:
15501565
15511566.. configuration-block ::
15521567
0 commit comments