From a647e166e1997b0233c330b2f5cacc3022a8bdd0 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 17 Nov 2015 11:07:07 +0100 Subject: [PATCH] Added a note about the use of _format query parameter --- book/routing.rst | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/book/routing.rst b/book/routing.rst index 3881dc78a3a..0d9baaddef9 100644 --- a/book/routing.rst +++ b/book/routing.rst @@ -1028,12 +1028,20 @@ a slash. URLs matching this route might look like: This example also highlights the special ``_format`` routing parameter. When using this parameter, the matched value becomes the "request format" - of the ``Request`` object. Ultimately, the request format is used for such - things as setting the ``Content-Type`` of the response (e.g. a ``json`` - request format translates into a ``Content-Type`` of ``application/json``). - It can also be used in the controller to render a different template for - each value of ``_format``. The ``_format`` parameter is a very powerful way - to render the same content in different formats. + of the ``Request`` object. + + Ultimately, the request format is used for such things as setting the + ``Content-Type`` of the response (e.g. a ``json`` request format translates + into a ``Content-Type`` of ``application/json``). It can also be used in the + controller to render a different template for each value of ``_format``. + The ``_format`` parameter is a very powerful way to render the same content + in different formats. + + In Symfony versions previous to 3.0, it is possible to override the request + format by adding a query parameter named ``_format`` (for example: + ``/foo/bar?_format=json``). Relying on this behavior not only is considered + a bad practice but it will complicate the upgrade of your applications to + Symfony 3. .. note::