From 66d60d217e88dff8d53bad319e144db5b514eb90 Mon Sep 17 00:00:00 2001 From: fatmuemoo Date: Mon, 2 Dec 2013 13:17:41 -0500 Subject: [PATCH 1/2] Update routing.rst Added a note to provide extra guidance when naming routes --- book/routing.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/book/routing.rst b/book/routing.rst index 44024702f67..6cba60a1532 100644 --- a/book/routing.rst +++ b/book/routing.rst @@ -68,6 +68,13 @@ The route is simple: return $collection; +.. note:: + + When defining routes, the key (e.g. ``blog_show``) is meaningless. + Just be sure that it's unique so no other lines override it. In most cases, a + vendorname_shortbundlename_controllername_actionname pattern + (e.g. ``acme_blog_show``) is appropriate. + .. versionadded:: 2.2 The ``path`` option was introduced in Symfony 2.2, ``pattern`` is used in older versions. From 90e654b73e58d650f9148d2fde26d1043abf90bb Mon Sep 17 00:00:00 2001 From: WouterJ Date: Wed, 21 May 2014 10:56:28 +0200 Subject: [PATCH 2/2] Applied comments --- book/routing.rst | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/book/routing.rst b/book/routing.rst index 6cba60a1532..3d05d462d6a 100644 --- a/book/routing.rst +++ b/book/routing.rst @@ -68,13 +68,6 @@ The route is simple: return $collection; -.. note:: - - When defining routes, the key (e.g. ``blog_show``) is meaningless. - Just be sure that it's unique so no other lines override it. In most cases, a - vendorname_shortbundlename_controllername_actionname pattern - (e.g. ``acme_blog_show``) is appropriate. - .. versionadded:: 2.2 The ``path`` option was introduced in Symfony 2.2, ``pattern`` is used in older versions. @@ -82,7 +75,9 @@ The route is simple: The path defined by the ``blog_show`` route acts like ``/blog/*`` where the wildcard is given the name ``slug``. For the URL ``/blog/my-blog-post``, the ``slug`` variable gets a value of ``my-blog-post``, which is available -for you to use in your controller (keep reading). +for you to use in your controller (keep reading). The ``blog_show`` is the +internal name of the route, which doesn't have any meaning yet and just needs +to be unique. Later, you'll use it to generate URLs. The ``_controller`` parameter is a special key that tells Symfony which controller should be executed when a URL matches this route. The ``_controller`` string