Permalink
Browse files

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
  • Loading branch information...
weaverryan committed Apr 2, 2014
2 parents abca098 + 75d06e6 commit 44c6273ad86e8506463e23e88bcbac5f03e2a680
Showing with 9 additions and 0 deletions.
  1. +7 −0 book/service_container.rst
  2. +2 −0 components/dependency_injection/advanced.rst
@@ -1001,6 +1001,13 @@ By default only public services are shown, but you can also view private service
$ php app/console container:debug --show-private
.. note::
If a private service is only used as an argument to just *one* other service,
it won't be displayed by the ``container:debug`` command, even when using
the ``--show-private`` option. See :ref:`Inline Private Services <inlined-private-services>`
for more details.
You can get more detailed information about a particular service by specifying
its id:
@@ -18,6 +18,8 @@ However, there are use-cases when you don't want a service to be public. This
is common when a service is only defined because it could be used as an
argument for another service.
.. _inlined-private-services:
.. note::
If you use a private service as an argument to only one other service,

0 comments on commit 44c6273

Please sign in to comment.