Skip to content

Altering docs to use new method names for requestedResponseFormat #8777

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions create_framework/event_dispatcher.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions templating/formats.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ 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,
));
}
}

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
Expand Down