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] Inject defaults and instanceof conditionals in anonymous services#21999

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

Closed
GuilhemN wants to merge1 commit intosymfony:masterfromGuilhemN:ANONYMOUS

Conversation

@GuilhemN
Copy link
Contributor

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

This PR injects defaults and instanceof conditionals in anonymous services to be consistent for all services.

services:_defaults:autowire:trueBar:[ !service { class: Quz } ]

In this example,Bar and the anonymous service will be autowired.

One special case: instanceof conditionals aren't injected in anonymous services used in instanceof conditionals.

$configuratorService =$this->getChildren($configurator,'service');

if (isset($configuratorService[0])) {
$class =$this->parseDefinition($configuratorService[0],$file);
Copy link
ContributorAuthor

@GuilhemNGuilhemNMar 14, 2017
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I fixed another bug at the same time, the fact that the factories/configurators were inline meant for prototypes/instanceof conditionals that different instances could be created for one anonymous service which wasn't consistent with how other anonymous services are created.
Note that it wasn't an issue before 3.3 as a service was never cloned.

@nicolas-grekas
Copy link
Member

rebase needed

@GuilhemN
Copy link
ContributorAuthor

@nicolas-grekas done

@GuilhemNGuilhemNforce-pushed theANONYMOUS branch 2 times, most recently from98ddc3f toec5b923CompareMarch 22, 2017 14:22
@nicolas-grekas
Copy link
Member

Thinking again about that, what about going the other way around: have defaults and instanceof apply only to root level definitions, and not to nested (inline) ones?
That'd be my preference.
If you agree, let's close this PR and work on another one.

@GuilhemN
Copy link
ContributorAuthor

Thinking again about that, what about going the other way around: have defaults and instanceof apply only to root level definitions, and not to nested (inline) ones?

That's the current behavior.

That'd be my preference.
If you agree, let's close this PR and work on another one.

I agree, thinking about it again I don't think this change is worth it. Let's close it and open a different PR for#21999 (comment).

@GuilhemNGuilhemN deleted the ANONYMOUS branchApril 4, 2017 17:44
fabpot added a commit that referenced this pull requestApr 5, 2017
This PR was squashed before being merged into the 3.3-dev branch (closes#22279).Discussion----------[DI] Fix anonymous factories/configurators support| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | yes| New feature?  | no <!-- 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 |#21999 (comment)| License       | MIT| Doc PR        |Using prototypes / instanceof conditionals, anonymous factories are inlined using `Definition`, so a new instance will be created for every service created from the prototype / conditional which is inconsistent with the way other anonymous services are managed.Commits-------dda43ed [DI] Fix anonymous factories/configurators support
symfony-splitter pushed a commit to symfony/dependency-injection that referenced this pull requestApr 5, 2017
This PR was squashed before being merged into the 3.3-dev branch (closes #22279).Discussion----------[DI] Fix anonymous factories/configurators support| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | yes| New feature?  | no <!-- 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 |symfony/symfony#21999 (comment)| License       | MIT| Doc PR        |Using prototypes / instanceof conditionals, anonymous factories are inlined using `Definition`, so a new instance will be created for every service created from the prototype / conditional which is inconsistent with the way other anonymous services are managed.Commits-------dda43ed8ce [DI] Fix anonymous factories/configurators support
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

3.3

Development

Successfully merging this pull request may close these issues.

3 participants

@GuilhemN@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp