Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fca1a5b

Browse filesBrowse files
committed
[FrameworkBundle] Improve the DX of TemplateController
1 parent 87737b1 commit fca1a5b
Copy full SHA for fca1a5b

File tree

1 file changed

+7
-7
lines changed
Filter options

1 file changed

+7
-7
lines changed

‎templating/render_without_controller.rst

Copy file name to clipboardExpand all lines: templating/render_without_controller.rst
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Usually, when you need to create a page, you need to create a controller
88
and render a template from within that controller. But if you're rendering
99
a simple template that doesn't need any data passed into it, you can avoid
1010
creating the controller entirely, by using the built-in
11-
``Symfony\Bundle\FrameworkBundle\Controller\TemplateController::templateAction``
11+
:class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\TemplateController`
1212
controller.
1313

1414
For example, suppose you want to render a ``static/privacy.html.twig``
@@ -22,7 +22,7 @@ can do this without creating a controller:
2222
# config/routes.yaml
2323
acme_privacy:
2424
path: /privacy
25-
controller: Symfony\Bundle\FrameworkBundle\Controller\TemplateController::templateAction
25+
controller: Symfony\Bundle\FrameworkBundle\Controller\TemplateController
2626
defaults:
2727
template: static/privacy.html.twig
2828
@@ -35,7 +35,7 @@ can do this without creating a controller:
3535
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
3636
3737
<route id="acme_privacy" path="/privacy">
38-
<default key="_controller">Symfony\Bundle\FrameworkBundle\Controller\TemplateController::templateAction</default>
38+
<default key="_controller">Symfony\Bundle\FrameworkBundle\Controller\TemplateController</default>
3939
<default key="template">static/privacy.html.twig</default>
4040
</route>
4141
</routes>
@@ -48,7 +48,7 @@ can do this without creating a controller:
4848
4949
$routes = new RouteCollection();
5050
$routes->add('acme_privacy', new Route('/privacy', array(
51-
'_controller' => 'Symfony\Bundle\FrameworkBundle\Controller\TemplateController::templateAction',
51+
'_controller' => 'Symfony\Bundle\FrameworkBundle\Controller\TemplateController',
5252
'template' => 'static/privacy.html.twig',
5353
)));
5454
@@ -83,7 +83,7 @@ other variables in your route, you can control exactly how your page is cached:
8383
# config/routes.yaml
8484
acme_privacy:
8585
path: /privacy
86-
controller: Symfony\Bundle\FrameworkBundle\Controller\TemplateController::templateAction
86+
controller: Symfony\Bundle\FrameworkBundle\Controller\TemplateController
8787
defaults:
8888
template: 'static/privacy.html.twig'
8989
maxAge: 86400
@@ -98,7 +98,7 @@ other variables in your route, you can control exactly how your page is cached:
9898
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
9999
100100
<route id="acme_privacy" path="/privacy">
101-
<default key="_controller">Symfony\Bundle\FrameworkBundle\Controller\TemplateController::templateAction</default>
101+
<default key="_controller">Symfony\Bundle\FrameworkBundle\Controller\TemplateController</default>
102102
<default key="template">static/privacy.html.twig</default>
103103
<default key="maxAge">86400</default>
104104
<default key="sharedAge">86400</default>
@@ -113,7 +113,7 @@ other variables in your route, you can control exactly how your page is cached:
113113
114114
$routes = new RouteCollection();
115115
$routes->add('acme_privacy', new Route('/privacy', array(
116-
'_controller' => 'Symfony\Bundle\FrameworkBundle\Controller\TemplateController::templateAction',
116+
'_controller' => 'Symfony\Bundle\FrameworkBundle\Controller\TemplateController',
117117
'template' => 'static/privacy.html.twig',
118118
'maxAge' => 86400,
119119
'sharedAge' => 86400,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.