@@ -66,22 +66,21 @@ Then you can define it as a service as follows:
66
66
67
67
# app/config/services.yml
68
68
services :
69
- AppBundle\Controller\HelloController :
70
- class : AppBundle\Controller\HelloController
69
+ AppBundle\Controller\HelloController : ~
71
70
72
71
.. code-block :: xml
73
72
74
73
<!-- app/config/services.xml -->
75
74
<services >
76
- <service id =" AppBundle\Controller\HelloController" class = " AppBundle\Controller\HelloController " />
75
+ <service id =" AppBundle\Controller\HelloController" />
77
76
</services >
78
77
79
78
.. code-block :: php
80
79
81
80
// app/config/services.php
82
81
use AppBundle\Controller\HelloController;
83
82
84
- $container->register(HelloController::class, HelloController::class );
83
+ $container->register(HelloController::class);
85
84
86
85
Referring to the Service
87
86
------------------------
@@ -220,14 +219,13 @@ argument:
220
219
# app/config/services.yml
221
220
services :
222
221
AppBundle\Controller\HelloController :
223
- class : AppBundle\Controller\HelloController
224
222
arguments : ['@templating']
225
223
226
224
.. code-block :: xml
227
225
228
226
<!-- app/config/services.xml -->
229
227
<services >
230
- <service id =" AppBundle\Controller\HelloController" class = " AppBundle\Controller\HelloController " >
228
+ <service id =" AppBundle\Controller\HelloController" >
231
229
<argument type =" service" id =" templating" />
232
230
</service >
233
231
</services >
@@ -236,10 +234,9 @@ argument:
236
234
237
235
// app/config/services.php
238
236
use AppBundle\Controller\HelloController;
239
- use Symfony\Component\DependencyInjection\Definition;
240
237
use Symfony\Component\DependencyInjection\Reference;
241
238
242
- $container->register(HelloController::class, HelloController::class )
239
+ $container->register(HelloController::class)
243
240
->addArgument(new Reference('templating'));
244
241
245
242
Rather than fetching the ``templating `` service from the container, you can
0 commit comments