8000 minor #3727 Added a note about inlined private services (javiereguiluz) · symfony/symfony-docs@44c6273 · GitHub
[go: up one dir, main page]

Skip to content

Commit 44c6273

Browse files
committed
minor #3727 Added a note about inlined private services (javiereguiluz)
This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes #3727). Discussion ---------- Added a note about inlined private services | Q | A | ------------- | --- | Doc fix? | no | New docs? | yes | Applies to | 2.3+ | Fixed tickets | - When you define private services that are used just as arguments for another service, Symfon2 doesn't define them as services, but inlines them in the other service definition. This slightly improves the performance of the container, but it's confusing for Symfony beginners because the private services aren't displayed by the `container:debug` command even when using the `--show-private` option: ``` $ php app/console container:debug --show-private ``` Commits ------- 15a7be0 [book] [service_container] added the title of a cross reference 835b52f Emphasized the fact that this only applies when the private service is used as argument for a single service 04cb9d4 Added a note about inlined private services
2 parents abca098 + 75d06e6 commit 44c6273

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

book/service_container.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,6 +1001,13 @@ By default only public services are shown, but you can also view private service
10011001
10021002
$ php app/console container:debug --show-private
10031003
1004+
.. note::
1005+
1006+
If a private service is only used as an argument to just *one* other service,
1007+
it won't be displayed by the ``container:debug`` command, even when using
1008+
the ``--show-private`` option. See :ref:`Inline Private Services <inlined-private-services>`
1009+
for more details.
1010+
10041011
You can get more detailed information about a particular service by specifying
10051012
its id:
10061013

components/dependency_injection/advanced.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ However, there are use-cases when you don't want a service to be public. This
1818
is common when a service is only defined because it could be used as an
1919
argument for another service.
2020

21+
.. _inlined-private-services:
22+
2123
.. note::
2224

2325
If you use a private service as an argument to only one other service,

0 commit comments

Comments
 (0)
0