8000 Wrong documentation for the DI component · Issue #4211 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Wrong documentation for the DI component #4211

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
stof opened this issue Sep 8, 2014 · 8 comments
Closed

Wrong documentation for the DI component #4211

stof opened this issue Sep 8, 2014 · 8 comments

Comments

@stof
Copy link
Member
stof commented Sep 8, 2014

The doc of the DI component shows the syntax to reference services in parameters: http://symfony.com/doc/current/components/dependency_injection/parameters.html#syntax-for-referencing-services

However, this does not work. Referencing services in parameters is impossible (parameters are scalars or arrays only, while services are object). Referencing services with such syntax works for arguments

@xabbuh
Copy link
Member
xabbuh commented Sep 8, 2014

@stof What's the reason then to have a "service" type in the XML schema? Is it there to not break BC? Did that ever work?

@stof
Copy link
Member Author
stof commented Sep 8, 2014

@xabbuh IMO, this is a mistake. If you use it, the loader will work (because it uses the same logic for arguments and parameters), but you will get an exception when dumping the container in the cache telling you that parameters cannot be objects.
I don't think it ever worked

@xabbuh
Copy link
Member
xabbuh commented Sep 8, 2014

@stof What do you think about removing these parts from the XSD then?

@wouterj
Copy link
Member
wouterj commented Sep 8, 2014

@xabbuh that's a BC break

@stof
Copy link
Member Author
stof commented Sep 8, 2014

not really given that anyone using type="service" in their XML file is already getting a LogicException later.

@xabbuh
Copy link
Member
xabbuh commented Sep 8, 2014

@wouterj If parsing the XML configuration fails nobody will be able to use it that way.

@xabbuh
Copy link
Member
xabbuh commented Sep 13, 2014

However, when the container is finally dumped this will fail at all with an exception message like "you cannot dump a container with parameters that contain references to other services".

fabpot added a commit to symfony/symfony that referenced this issue Sep 13, 2014
… XSD (xabbuh)

This PR was merged into the 2.3 branch.

Discussion
----------

[DependencyInjection] remove `service` parameter type from XSD

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        | symfony/symfony-docs#4222

Referencing a service in a parameter doesn't work and will lead to an error when the configuration is loaded (see symfony/symfony-docs#4211).

Commits
-------

7333c2d remove `service` parameter type from XSD
weaverryan added a commit that referenced this issue Sep 16, 2014
… in parameters (xabbuh)

This PR was merged into the 2.3 branch.

Discussion
----------

[Components][DependencyInjection] do not reference services in parameters

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | all
| Fixed tickets | #4211

Commits
-------

4b10abf do not reference services in parameters
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

No branches or pull requests

4 participants
0