@@ -709,8 +709,11 @@ tags:
709709 array('renderer' => 'hinclude')
710710 ) ?>
711711
712+ <!-- The url() method was introduced in Symfony 2.8. Prior to 2.8, you
713+ had to use generate() with UrlGeneratorInterface::ABSOLUTE_URL
714+ passed as third argument. -->
712715 <?php echo $view['actions']->render(
713- $view['router']->generate ('...'),
716+ $view['router']->url ('...'),
714717 array('renderer' => 'hinclude')
715718 ) ?>
716719
@@ -918,7 +921,9 @@ To link to the page, just use the ``path`` Twig function and refer to the route:
918921
919922 .. code-block :: html+php
920923
921- <a href="<?php echo $view['router']->generate('_welcome') ?>">Home</a>
924+ <!-- The path() method was introduced in Symfony 2.8. Prior to 2.8, you
925+ had to use generate(). -->
926+ <a href="<?php echo $view['router']->path('_welcome') ?>">Home</a>
922927
923928As expected, this will generate the URL ``/ ``. Now, for a more complicated
924929route:
@@ -997,7 +1002,9 @@ correctly:
9971002
9981003 <!-- app/Resources/views/Article/recent_list.html.php -->
9991004 <?php foreach ($articles in $article): ?>
1000- <a href="<?php echo $view['router']->generate('article_show', array(
1005+ <!-- The path() method was introduced in Symfony 2.8. Prior to 2.8,
1006+ you had to use generate(). -->
1007+ <a href="<?php echo $view['router']->path('article_show', array(
10011008 'slug' => $article->getSlug(),
10021009 )) ?>">
10031010 <?php echo $article->getTitle() ?>
@@ -1006,26 +1013,26 @@ correctly:
10061013
10071014.. tip ::
10081015
1009- You can also generate an absolute URL by using the ``url `` Twig function:
1016+ You can also generate an absolute URL by using the ``url `` function:
10101017
1011- .. code -block :: html+twig
1018+ .. configuration -block ::
10121019
1013- <a href="{{ url('_welcome') }}">Home</a>
1020+ .. code-block :: html+twig
10141021
1015- The same can be done in PHP templates by passing a third argument to
1016- the ``generate() `` method:
1022+ <a href="{{ url('_welcome') }}">Home</a>
10171023
1018- .. code-block :: html+php
1024+ .. code-block :: html+php
10191025
1020- <?php
1021- use Symfony\C omponent\R outing\G enerator\U rlGeneratorInterface;
1022- ?>
1026+ <a href="<?php echo $view['router']->url(
1027+ '_welcome',
1028+ array()
1029+ ) ?>">Home</a>
10231030
1024- <a href="<?php echo $view['router']->generate(
1025- '_welcome',
1026- array(),
1027- UrlGeneratorInterface::ABSOLUTE_URL
1028- ) ?>">Home</a>
1031+ .. versionadded :: 2.8
1032+ The `` url() `` PHP templating helper was introduced in Symfony 2.8. Prior
1033+ to 2.8, you had to use the `` generate() `` helper method with
1034+ `` Symfony\Component\Routing\Generator\ UrlGeneratorInterface::ABSOLUTE_URL``
1035+ passed as third argument.
10291036
10301037.. index ::
10311038 single: Templating; Linking to assets
@@ -1696,7 +1703,9 @@ key in the parameter hash:
16961703
16971704 .. code-block :: html+php
16981705
1699- <a href="<?php echo $view['router']->generate('article_show', array(
1706+ <!-- The path() method was introduced in Symfony 2.8. Prior to 2.8, you
1707+ had to use generate(). -->
1708+ <a href="<?php echo $view['router']->path('article_show', array(
17001709 'id' => 123,
17011710 '_format' => 'pdf',
17021711 )) ?>">
0 commit comments