From 7adfb0ca25a3f71ff4aeaa4b8084e98b50ef6ca4 Mon Sep 17 00:00:00 2001 From: Parraghy Norbert Date: Wed, 9 Nov 2016 15:41:16 +0100 Subject: [PATCH] Update formats.rst The controller is a little bit confusing. I think it should be a showAction, since it's name is article_show and it gets an id as parameter. --- templating/formats.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/templating/formats.rst b/templating/formats.rst index 565255f22bb..55af8df475d 100644 --- a/templating/formats.rst +++ b/templating/formats.rst @@ -22,11 +22,13 @@ In many cases, you may want to allow a single controller to render multiple different formats based on the "request format". For that reason, a common pattern is to do the following:: - public function indexAction(Request $request) + public function showAction(Request $request, Article $entity) { $format = $request->getRequestFormat(); - return $this->render('article/index.'.$format.'.twig'); + return $this->render('article/index.'.$format.'.twig', [ + 'entity' => $entity + ]); } The ``getRequestFormat`` on the ``Request`` object defaults to ``html``,