Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[DependencyInjection] Support anonymous services in Yaml#21970
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
5ba0c74 tobec639fComparec4f6dea to7a00fdbCompare
nicolas-grekas left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
👍
Defaults and instanceof conditionals aren't applied on anonymous services, as in xml too.
Just wondering about this catch. Does anyone have an opinion on this? (for another PR thought)
| if (is_array($value)) { | ||
| $value =array_map(array($this,'resolveServices'),$value); | ||
| foreach ($valueas &$v) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
would be better to get rid of the reference to me
| returnnewClosureProxyArgument($argument[0],$argument[1],$invalidBehavior); | ||
| } | ||
| // Anonymous service |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
not sure this comment provides anything
nicolas-grekas commentedMar 14, 2017 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Thinking a bit more about this, my opinion on it is that it's a bug that should be fixed in XmlFileLoader also. |
nicolas-grekas commentedMar 14, 2017
good to merge as is to me, my previous comments are for another PR |
fabpot commentedMar 14, 2017
Thank you@GuilhemN. |
…ml (GuilhemN)This PR was merged into the 3.3-dev branch.Discussion----------[DependencyInjection] Support anonymous services in Yaml| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes <!-- don't forget updating src/**/CHANGELOG.md files -->| BC breaks? | no| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->| Tests pass? | yes| Fixed tickets |#16328| License | MIT| Doc PR |This PR allows creating anonymous services in yaml using the `!service` tag as proposed by@nicolas-grekas:```ymlservices: _instanceof: FooInterface: arguments: - !service class: Bar autowire: true Foo: factory: [ !service { class: Quz }, 'constructFoo' ]```Anonymous services are forbidden in parameters as in xml.Defaults and instanceof conditionals aren't applied on anonymous services, as in xml too.Commits-------9b71385 [DependencyInjection] Support anonymous services in Yaml
Uh oh!
There was an error while loading.Please reload this page.
This PR allows creating anonymous services in yaml using the
!servicetag as proposed by@nicolas-grekas:Anonymous services are forbidden in parameters as in xml.
Defaults and instanceof conditionals aren't applied on anonymous services, as in xml too.