File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -817,15 +817,13 @@ loss, enable the compiler pass in your application.
817
817
Public Versus Private Services
818
818
------------------------------
819
819
820
- Every service defined is private by default. When a service is private,
821
- you cannot accees it directly from the container object (using
822
- ``$container->get() ``). As a best practice, you should only create
823
- *private * services, which will happen automatically. And also, you should
824
- *not * use the ``$container->get() `` method to fetch services, but instead
825
- use dependency injection.
820
+ Every service defined is private by default. When a service is private, you
821
+ cannot access it directly from the container using ``$container->get() ``. As a
822
+ best practice, you should only create *private * services and you should fetch
823
+ services using dependency injection instead of using ``$container->get() ``.
826
824
827
825
If you need to fetch services lazily, instead of using public services you
828
- should consider using a :ref: `service locator <service-locators >` instead .
826
+ should consider using a :ref: `service locator <service-locators >`.
829
827
830
828
But, if you *do * need to make a service public, override the ``public ``
831
829
setting:
You can’t perform that action at this time.
0 commit comments