From b547804b1e777441dc96b398e52ef5c71de2b10e Mon Sep 17 00:00:00 2001 From: Victor Bocharsky Date: Sun, 2 Oct 2016 22:55:05 +0300 Subject: [PATCH] Remove dash prefix from route name Actually, in most cases, the `_` prefix means something internal and probably better to avoid using it in examples --- templating.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/templating.rst b/templating.rst index 50ad22ee7ca..b14ef6681f5 100644 --- a/templating.rst +++ b/templating.rst @@ -578,7 +578,7 @@ the routing configuration. Later, if you want to modify the URL of a particular page, all you'll need to do is change the routing configuration; the templates will automatically generate the new URL. -First, link to the "_welcome" page, which is accessible via the following routing +First, link to the "welcome" page, which is accessible via the following routing configuration: .. configuration-block:: @@ -593,7 +593,7 @@ configuration: class WelcomeController extends Controller { /** - * @Route("/", name="_welcome") + * @Route("/", name="welcome") */ public function indexAction() { @@ -604,7 +604,7 @@ configuration: .. code-block:: yaml # app/config/routing.yml - _welcome: + welcome: path: / defaults: { _controller: AppBundle:Welcome:index } @@ -617,7 +617,7 @@ configuration: xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + AppBundle:Welcome:index @@ -629,7 +629,7 @@ configuration: use Symfony\Component\Routing\RouteCollection; $collection = new RouteCollection(); - $collection->add('_welcome', new Route('/', array( + $collection->add('welcome', new Route('/', array( '_controller' => 'AppBundle:Welcome:index', ))); @@ -641,11 +641,11 @@ To link to the page, just use the ``path`` Twig function and refer to the route: .. code-block:: html+twig - Home + Home .. code-block:: html+php - Home + Home As expected, this will generate the URL ``/``. Now, for a more complicated route: @@ -737,7 +737,7 @@ correctly: .. code-block:: html+twig - Home + Home The same can be done in PHP templates by passing a third argument to the ``generate()`` method: @@ -749,7 +749,7 @@ correctly: ?> Home