From 377dc17e1b629e9c00721b0ea4a6c66c2f8d7f10 Mon Sep 17 00:00:00 2001 From: Matt Williams Date: Wed, 29 Nov 2017 18:07:40 +0000 Subject: [PATCH] Altering docs to use new method names for requestedResponseFormat --- create_framework/event_dispatcher.rst | 4 ++-- templating/formats.rst | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/create_framework/event_dispatcher.rst b/create_framework/event_dispatcher.rst index 12f8e39b433..cf913affa63 100644 --- a/create_framework/event_dispatcher.rst +++ b/create_framework/event_dispatcher.rst @@ -131,7 +131,7 @@ the registration of a listener for the ``response`` event:: if ($response->isRedirection() || ($response->headers->has('Content-Type') && false === strpos($response->headers->get('Content-Type'), 'html')) - || 'html' !== $event->getRequest()->getRequestFormat() + || 'html' !== $event->getRequest()->getRequestedResponseFormat() ) { return; } @@ -210,7 +210,7 @@ Let's refactor the code a bit by moving the Google listener to its own class:: if ($response->isRedirection() || ($response->headers->has('Content-Type') && false === strpos($response->headers->get('Content-Type'), 'html')) - || 'html' !== $event->getRequest()->getRequestFormat() + || 'html' !== $event->getRequest()->getRequestedResponseFormat() ) { return; } diff --git a/templating/formats.rst b/templating/formats.rst index 7d1893b50f8..8a3f17f749a 100644 --- a/templating/formats.rst +++ b/templating/formats.rst @@ -35,7 +35,7 @@ pattern is to do the following:: // retrieve the article based on $slug $article = ...; - $format = $request->getRequestFormat(); + $format = $request->getRequestedResponseFormat(); return $this->render('article/show.'.$format.'.twig', array( 'article' => $article, @@ -43,7 +43,7 @@ pattern is to do the following:: } } -The ``getRequestFormat()`` on the ``Request`` object defaults to ``html``, +The ``getRequestedResponseFormat()`` on the ``Request`` object defaults to ``html``, but can return any other format based on the format requested by the user. The request format is most often managed by the routing, where a route can be configured so that ``/about-us`` sets the request format to ``html`` while