-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DependencyInjection] Apply attribute configurator to child classes #54365
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/Symfony/Component/DependencyInjection/Compiler/AttributeAutoconfigurationPass.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/DependencyInjection/Tests/Compiler/AttributeAutoconfigurationPassTest.php
Outdated
Show resolved
Hide resolved
2c896cb
to
2390a26
Compare
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.
Looks sensible to me. I'd suggest checking our current attribute list to make sure there's no blocker in extending each of them (and make those final if any, or hard-skip them)
src/Symfony/Component/DependencyInjection/Compiler/AttributeAutoconfigurationPass.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/DependencyInjection/Compiler/AttributeAutoconfigurationPass.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/DependencyInjection/Compiler/AttributeAutoconfigurationPass.php
Show resolved
Hide resolved
The list of autoconfigured attributes is in
|
The use case for |
It will be also possible to remove the handling for all the symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php Lines 1108 to 1129 in bff8e08
|
All the internal attributes can be extended and we already have an internal use-case with Workflow attributes. Ready for review. |
b11cb5b
to
69dc71b
Compare
Thank you @GromNaN. |
…Handler` (GromNaN) This PR was merged into the 7.1 branch. Discussion ---------- [Messenger] Allow extending attribute class `AsMessageHandler` | Q | A | ------------- | --- | Branch? | 7.1 | Bug fix? | no | New feature? | yes | Deprecations? | no | Issues | - | License | MIT Revert #52971 which made `AsMessageHandler` final. Discussed in #54365 (comment) Commits ------- 9479563 Allow extending AsMessageHandler
…tener attributes (GromNaN) This PR was merged into the 7.1 branch. Discussion ---------- [FrameworkBundle] Remove custom handler for Workflow listener attributes | Q | A | ------------- | --- | Branch? | 7.1 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | - | License | MIT All the `Workflow\Attribute\As*Listener` classes extend `AsEventListener`. Since the attribute handler are now applied to child classes (#54365), it's no longer necessary to declare an attribute handler for each attribute. Discussed in #54365 (comment) Commits ------- db7004c Remove custom handler for Workflow listener attributes
This allows extending attribute classes registered for autoconfiguration.
Use-case: Share configuration between several classes with pre-configured attribute classes. As described in #52898 (bus name for
AsMessageHandler
, schedule name forAsCronTask
andAsPeriodicTask
)The child-class attribute is handled by the same function as it's parent class that is registered for autoconfiguration. This means any additional property will be ignored (unless supported, which could be new feature for the
AsTaggedItem
attribute configurator).If there is a configurator for the child class, the configurator for the parent class is not called.