From f00efff224be443eed52c66b174270be8b064403 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 20 Oct 2015 11:53:45 +0200 Subject: [PATCH] use constants to choose generated URL type --- book/routing.rst | 6 +++++- book/templating.rst | 6 +++++- cookbook/controller/service.rst | 7 ++++++- cookbook/templating/render_without_controller.rst | 6 +++++- create_framework/routing.rst | 8 +++++++- 5 files changed, 28 insertions(+), 5 deletions(-) diff --git a/book/routing.rst b/book/routing.rst index 4476031a7c9..e128c5412e7 100644 --- a/book/routing.rst +++ b/book/routing.rst @@ -1499,9 +1499,13 @@ to ``generate()``: .. code-block:: html+php + + + ), UrlGeneratorInterface::ABSOLUTE_URL) ?>"> Read this blog post. diff --git a/book/templating.rst b/book/templating.rst index 832192aad7e..2391e195085 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -992,10 +992,14 @@ correctly: .. code-block:: html+php + + Home .. index:: diff --git a/cookbook/controller/service.rst b/cookbook/controller/service.rst index 5213004da20..50f91425be5 100644 --- a/cookbook/controller/service.rst +++ b/cookbook/controller/service.rst @@ -269,7 +269,12 @@ controller: :method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller::generateUrl` (service: ``router``) .. code-block:: php - $router->generate($route, $params, $absolute); + $router->generate($route, $params, $referenceType); + + .. note:: + + The ``$referenceType`` argument must be one of the constants defined + in the :class:`Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface`. :method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller::getDoctrine` (service: ``doctrine``) diff --git a/cookbook/templating/render_without_controller.rst b/cookbook/templating/render_without_controller.rst index cd9a6b8fc70..a3f35cd48e9 100644 --- a/cookbook/templating/render_without_controller.rst +++ b/cookbook/templating/render_without_controller.rst @@ -68,8 +68,12 @@ this is probably only useful if you'd like to cache this page partial (see .. code-block:: html+php + + render( - $view['router']->generate('acme_privacy', array(), true) + $view['router']->generate('acme_privacy', array(), UrlGeneratorInterface::ABSOLUTE_URL) ) ?> .. _cookbook-templating-no-controller-caching: diff --git a/create_framework/routing.rst b/create_framework/routing.rst index 7d84622e4c0..8a59ce83c8a 100644 --- a/create_framework/routing.rst +++ b/create_framework/routing.rst @@ -208,7 +208,13 @@ impact. Want to know how to use the generator? Insanely easy:: The code should be self-explanatory; and thanks to the context, you can even generate absolute URLs:: - echo $generator->generate('hello', array('name' => 'Fabien'), true); + use Symfony\Component\Routing\Generator\UrlGeneratorInterface; + + echo $generator->generate( + 'hello', + array('name' => 'Fabien'), + UrlGeneratorInterface::ABSOLUTE_URL + ); // outputs something like http://example.com/somewhere/hello/Fabien .. tip::