Skip to content

Commit 5862c75

Browse files
ibronitwouterj
authored andcommitted
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.
1 parent 4de8599 commit 5862c75

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

templating/formats.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ In many cases, you may want to allow a single controller to render multiple
2222
different formats based on the "request format". For that reason, a common
2323
pattern is to do the following::
2424

25-
public function indexAction(Request $request)
25+
public function showAction(Request $request, Article $entity)
2626
{
2727
$format = $request->getRequestFormat();
2828

29-
return $this->render('article/index.'.$format.'.twig');
29+
return $this->render('article/index.'.$format.'.twig', [
30+
'entity' => $entity
31+
]);
3032
}
3133

3234
The ``getRequestFormat()`` on the ``Request`` object defaults to ``html``,

0 commit comments

Comments
 (0)