8000 Add documentation for anonymous services · Issue #5854 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Add documentation for anonymous services #5854

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

Closed
Haehnchen opened this issue Nov 2, 2015 · 8 comments
Closed

Add documentation for anonymous services #5854

Haehnchen opened this issue Nov 2, 2015 · 8 comments
Labels
actionable Clear and specific issues ready for anyone to take them. DependencyInjection

Comments

@Haehnchen
Copy link

Do we have any documentation for "anonymous services"? i googled some terms about this feature but not getting results on the official page. Some improvements would be nice here. :)

related: Haehnchen/idea-php-symfony2-plugin#595

The XML format supports anonymous services. An anonymous service is a service that does not need a name and is defined directly in its use context. It can be very convenient when you need a service that won't be used outside of another one scope:
http://fabien.potencier.org/symfony-service-container-using-xml-or-yaml-to-describe-services.html

@xabbuh
Copy link
Member
xabbuh commented Nov 2, 2015

I am not sure if we should really document this. Imho it's only useful for the dumpers to be able to dump the optimised container. But as the end user you don't really need this feature as making services private leads to the same anyway when the container is compiled.

@xabbuh
Copy link
Member
xabbuh commented Nov 2, 2015

And by the way, the Yaml format does not support anonymous services and won't get this feature in the future (see symfony/symfony#16328).

@HeahDude
Copy link
Contributor

@xabbuh So may be this one should get closed.

@Oliboy50
Copy link
Contributor

@xabbuh You're right, but this is maybe the only "syntactic sugar" for XML to compensate for its insane verbosity... It just seems sad to not document this :trollface:

@SimonHeimberg
Copy link
Contributor

When "anonymous service" is undocumented, it should not be mentioned in the doc in http://symfony.com/doc/current/service_container/service_locators.html#defining-a-service-locator

@Haehnchen
Copy link
Author

now it should be documented; also mentioned in #7694, see also symfony/symfony#21970

@HeahDude
Copy link
Contributor

Reopening until all versions and formats are properly documented.

@HeahDude HeahDude reopened this Jun 28, 2018
@HeahDude HeahDude added actionable Clear and specific issues ready for anyone to take them. and removed needs comments labels Jun 28, 2018
javiereguiluz added a commit that referenced this issue Jul 11, 2018
…aan)

This PR was merged into the 3.4 branch.

Discussion
----------

Add section about anonymous services in YAML

Fixes #7694.

This is a continuation of #9909 which added some information about anonymous services in XML to the docs, next will be a commit that describes configuring anonymous services in PHP for the `master` branch. For further information about the issue, see #5854.

Commits
-------

8a83664 Add section about anonymous services in YAML
@javiereguiluz
Copy link
Member

Fixed by #9909 and #10041.

63E2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
actionable Clear and specific issues ready for anyone to take them. DependencyInjection
Projects
None yet
Development

No branches or pull requests

6 participants
0