File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -78,9 +78,9 @@ a service like: ``App\Controller\HelloController::index``:
78
78
79
79
# config/routes.yaml
80
80
hello :
81
- path : /hello
81
+ path : /hello
82
82
controller : App\Controller\HelloController::index
83
- methods : GET
83
+ methods : GET
84
84
85
85
.. code-block :: xml
86
86
@@ -140,8 +140,8 @@ which is a common practice when following the `ADR pattern`_
140
140
141
141
# config/routes.yaml
142
142
hello :
143
- path : /hello/{name}
144
- controller : app.hello_controller
143
+ path : /hello/{name}
144
+ controller : App\Controller\HelloController
145
145
146
146
.. code-block :: xml
147
147
@@ -153,16 +153,18 @@ which is a common practice when following the `ADR pattern`_
153
153
https://symfony.com/schema/routing/routing-1.0.xsd" >
154
154
155
155
<route id =" hello" path =" /hello/{name}" >
156
- <default key =" _controller" >app.hello_controller </default >
156
+ <default key =" _controller" >App\Controller\HelloController </default >
157
157
</route >
158
158
159
159
</routes >
160
160
161
161
.. code-block :: php
162
162
163
+ use App\Controller\HelloController;
164
+
163
165
// app/config/routing.php
164
166
$collection->add('hello', new Route('/hello', [
165
- '_controller' => 'app.hello_controller' ,
167
+ '_controller' => HelloController::class ,
166
168
]));
167
169
168
170
Alternatives to base Controller Methods
You can’t perform that action at this time.
0 commit comments