Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a note about inlined private services #3727

Closed
wants to merge 3 commits into from
Closed

Added a note about inlined private services #3727

wants to merge 3 commits into from

Conversation

javiereguiluz
Copy link
Member

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

@@ -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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would emphasis "one": *one*

@wouterj
Copy link
Member

wouterj commented Mar 28, 2014

👍 (btw, if it applies to all versions, it should be merged into the 2.3 branch)

service is used as argument for a single service
@javiereguiluz
Copy link
Member Author

@wouterj added the emphasis on the one word.

Indeed this should be applied to any 2.3+ branch. Sorry for having committed to the wrong branch again!


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:`inlined-private-services` for a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because there's no header immediately after the target, we have to include a label here, something like:

:ref:`Inline Private Services <inlined-private-services>` for more details.

@weaverryan
Copy link
Member

Thanks Javier!

weaverryan added a commit that referenced this pull request Apr 2, 2014
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
@weaverryan weaverryan closed this Apr 2, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants