Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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

Merged
fabpot merged 1 commit intosymfony:masterfromGuilhemN:INLINESERVICE
Mar 14, 2017

Conversation

@GuilhemN
Copy link
Contributor

@GuilhemNGuilhemN commentedMar 10, 2017
edited
Loading

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#16328
LicenseMIT
Doc PR

This PR allows creating anonymous services in yaml using the!service tag as proposed by@nicolas-grekas:

services:_instanceof:FooInterface:arguments:                -!serviceclass:Barautowire:trueFoo: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.

Exter-N, sstok, jvasseur, fbourigault, theofidry, hason, andreyserdjuk, demonkoryu, and RSalo reacted with thumbs up emoji
Copy link
Member

@nicolas-grekasnicolas-grekas left a 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) {

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

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

nicolas-grekas commentedMar 14, 2017
edited
Loading

Defaults and instanceof conditionals aren't applied on anonymous services, as in xml too.

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

good to merge as is to me, my previous comments are for another PR

@fabpot
Copy link
Member

Thank you@GuilhemN.

GuilhemN reacted with hooray emoji

@fabpotfabpot merged commit9b71385 intosymfony:masterMar 14, 2017
fabpot added a commit that referenced this pull requestMar 14, 2017
…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
@GuilhemNGuilhemN deleted the INLINESERVICE branchMarch 14, 2017 21:40
@fabpotfabpot mentioned this pull requestMay 1, 2017
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

3.3

Development

Successfully merging this pull request may close these issues.

4 participants

@GuilhemN@nicolas-grekas@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp