File tree 1 file changed +13
-9
lines changed
1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -29,20 +29,24 @@ you can "ask" for a service from the container by type-hinting an argument with
29
29
service's class or interface name. Want to :doc: `log </logging >` something? No problem::
30
30
31
31
// src/Controller/ProductController.php
32
- // ...
32
+ namespace App\Controller;
33
33
34
34
use Psr\Log\LoggerInterface;
35
35
36
- /**
37
- * @Route("/products")
38
- */
39
- public function list(LoggerInterface $logger)
36
+ class ProductController
40
37
{
41
- $logger->info('Look! I just used a service');
38
+ /**
39
+ * @Route("/products")
40
+ */
41
+ public function list(LoggerInterface $logger)
42
+ {
43
+ $logger->info('Look! I just used a service');
42
44
43
- // ...
45
+ // ...
46
+ }
44
47
}
45
48
49
+
46
50
What other services are available? Find out by running:
47
51
48
52
.. code-block :: terminal
@@ -222,7 +226,7 @@ the ``LoggerInterface`` type-hint. Set this on a new ``$logger`` property
222
226
and use it later::
223
227
224
228
// src/Service/MessageGenerator.php
225
- // ...
229
+ namespace App\Service;
226
230
227
231
use Psr\Log\LoggerInterface;
228
232
@@ -550,7 +554,7 @@ Choose a Specific Service
550
554
The ``MessageGenerator `` service created earlier requires a ``LoggerInterface `` argument::
551
555
552
556
// src/Service/MessageGenerator.php
553
- // ...
557
+ namespace App\Service;
554
558
555
559
use Psr\Log\LoggerInterface;
556
560
You can’t perform that action at this time.
0 commit comments