Skip to content

Commit 2ecc541

Browse files
committed
Fix missing constant usage for generating urls
1 parent e9760b2 commit 2ecc541

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

book/routing.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1479,7 +1479,9 @@ By default, the router will generate relative URLs (e.g. ``/blog``). From
14791479
a controller, simply pass ``true`` to the third argument of the ``generateUrl()``
14801480
method::
14811481

1482-
$this->generateUrl('blog_show', array('slug' => 'my-blog-post'), true);
1482+
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
1483+
1484+
$this->generateUrl('blog_show', array('slug' => 'my-blog-post'), UrlGeneratorInterface::ABSOLUTE_URL);
14831485
// http://www.example.com/blog/my-blog-post
14841486

14851487
From a template, in Twig, simply use the ``url()`` function (which generates an absolute URL)

0 commit comments

Comments
 (0)