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] Add a new Syntax to define factories as callables#12008
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
This was referencedSep 24, 2014
d2707b6 to4f7a82fCompareContributor
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.
Typo.
MemberAuthor
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.
good catch!
Member
stof commentedSep 24, 2014
👍 |
1 similar comment
MemberAuthor
fabpot commentedSep 24, 2014
👍 |
fabpot added a commit that referenced this pull requestSep 24, 2014
…ries as callables (realityking, fabpot)This PR was merged into the 2.6-dev branch.Discussion----------[DependencyInjection] Add a new Syntax to define factories as callables| Q | A| ------------- | ---| Bug fix? | no| New feature? | yes| BC breaks? | no| Deprecations? | yes| Tests pass? | yes| Fixed tickets | -| License | MIT| Doc PR | -From the original PR#9839:"This pull requests adds a new syntax to define factories based on the syntax for configurators. This is more flexible than the old syntax (factoryMethod and either of factoryClass or factoryService), as it also allows for functions as factories.Since the service is now a Reference to a Definition it also allows us to inline factories for a small performance improvement and better encapsulation.Lastly this prevents a bug where a private factory is simple removed because it's not referenced in the graph.I did not change any of the existing definitions (there's one use of a factory in FrameworkBundle) or automatically use the new internal representation when parsing YAML or XML definitions because this could introduce subtle B/C issues."Commits-------187aeee fixed CSbd8531d added a new Syntax to define factories as callables.
fabpot added a commit that referenced this pull requestOct 3, 2014
This PR was merged into the 2.6-dev branch.Discussion----------[DependencyInjection] Tweaked factories| Q | A| ------------- | ---| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#12008| License | MIT| Doc PR | n/aThere are some issues with new service factories: * `ContainerBuilder` cannot instantiate service from factory (i.e. currently it works for dumped code only) * Dumped code sometimes is invalid (anonymous services as factories, factories without arguments)Commits-------ee82392 [DependencyInjection] Tweaked factories
This was referencedNov 19, 2014
weaverryan added a commit to symfony/symfony-docs that referenced this pull requestNov 24, 2014
This PR was merged into the 2.6 branch.Discussion----------Use new factory syntax| Q | A| --- | ---| Doc fix? | no| New docs? | yes (symfony/symfony#12008)| Applies to | 2.6+| Fixed tickets |#4291Commits-------9cbcc2b Applied fixesd7998b0 Use new factory syntax
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
From the original PR#9839:
"This pull requests adds a new syntax to define factories based on the syntax for configurators. This is more flexible than the old syntax (factoryMethod and either of factoryClass or factoryService), as it also allows for functions as factories.
Since the service is now a Reference to a Definition it also allows us to inline factories for a small performance improvement and better encapsulation.
Lastly this prevents a bug where a private factory is simple removed because it's not referenced in the graph.
I did not change any of the existing definitions (there's one use of a factory in FrameworkBundle) or automatically use the new internal representation when parsing YAML or XML definitions because this could introduce subtle B/C issues.
"