Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #21071 [DI] Add "inherit-tags" with configurable defaults + s…
…ame for "public", "tags" & "autowire" (nicolas-grekas, ogizanagi) This PR was merged into the 3.3-dev branch. Discussion ---------- [DI] Add "inherit-tags" with configurable defaults + same for "public", "tags" & "autowire" | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #20048 | License | MIT | Doc PR | - Instead of making services private by default (#20048), which is going to create a big migration burden that might not be worth it, I'd like to propose the idea of changing the default for the current file. Having a place to redefine some defaults, this can also be used to enable autowiring for a file, making it much lighter in the end. This PR handles defaults for "public", "autowired" and "tags". Not sure the other options need a configurable default. Please comment if you think otherwise. Short example (the feat is more interesting with a longer list of services): ```yaml services: _defaults: public: false autowire: ['_construct', 'set*'] foo: class: Foo ``` ```xml <?xml version="1.0" encoding="utf-8"?> <container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> <services> <defaults public="false"> <autowire>__construct</autowire> <tag name="foo"/> </defaults> </services> </container> ``` ping @dunglas @weaverryan Commits ------- beec1cf [DI] Allow definitions to inherit tags from parent context 05f24d5 [DI] Add "defaults" tag to XML services configuration 7b4a18b [DI] Add "_defaults" key to Yaml services configuration
- Loading branch information
Showing
11 changed files
with
360 additions
and
27 deletions.
There are no files selected for viewing
This file contains 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 file contains 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 file contains 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 file contains 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 file contains 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
Oops, something went wrong.