-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Labels
Description
Q | A |
---|---|
Bug report? | no |
Feature request? | possibly |
BC Break report? | no |
RFC? | yes |
Symfony version | master |
I just created a service definition file like this SCCEE:
services:
_defaults:
tags: [ { name: kernel.event_subscriber } ]
some.event.subscriber:
calls:
- [setLogger, ["@logger"]]
tags: [ { name: monolog.logger, channel: specific_channel } ]
And then spent half an hour debugging why my events weren't being processed.
The reasoning is sound of course - I provided a default, and then I provided a real value overwriting the default. It's however not intuitive and imho highly confusing that this doesn't work like this out of the box.
I see 2 solutions to this:
- Merge tags by default based on name. Seems to make sense but it may go wrong in edge cases I'm not seeing.
- If a 'mergeable' property like
tags
is provided both in default/instanceof and definition, require setting a property in the likemerge_tags
explicitly to true or false, and bail out if it isn't set.
Comments?