-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Comments
@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? |
@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. |
@stof What do you think about removing these parts from the XSD then? |
@xabbuh that's a BC break |
not really given that anyone using |
@wouterj If parsing the XML configuration fails nobody will be able to use it that way. |
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". |
… 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
… 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
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
The text was updated successfully, but these errors were encountered: