File tree 1 file changed +9
-0
lines changed
1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -554,6 +554,15 @@ allows fetching both public and all non-removed private services::
554
554
For a list of services available in your application, use the ``debug:container ``
555
555
command.
556
556
557
+ .. tip ::
558
+
559
+ Keep in mind that, if a private service is never used as a dependency of another service in
560
+ your application, it is then removed from the container. So, if you try to access a private
561
+ service in a test through the special test container and that service isn't used elsewhere
562
+ you'll get a ``ServiceNotFoundException ``. The solution, depending on the context, is to
563
+ define the service as explicitly ``public `` or to inject it where you'll need it so Symfony
564
+ doesn't remove it.
565
+
557
566
.. tip ::
558
567
559
568
The special container that gives access to private services exists only in
You can’t perform that action at this time.
0 commit comments