-
-
Notifications
You must be signed in to change notification settings - Fork 228
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
Not activate channel on DefinitionDecorator instance #115
Comments
Another case which would need to move the <service id="service.abstract" abstract="true">
<argument type="service" id="logger" />
</service>
<service id="service.child" parent="service.abstract">
<tag name="monolog.logger" channel="test" />
</service> As I have the same structure / constructor but for different goals (pulling different things actually), so I need a different channel for each children. Because the pass is registered on So we basically need to currently duplicate our definitions instead of having a simple inheritance... I guess moving this pass to |
@Taluu moving it after the optimization would break thing, as the compiler pass is changing the graph of dependencies between services, and the optimizations are performed based on this dependency graph. For instance, handlers may get inlined by optimizations if the container thinks they are used by a single logger service, while they are later needed by multiple loggers and so cannot be inlined. It would also make it much harder to change the logger in private services which gets inlined and removed by optimizations, as we would have to look at any service to find inlined arguments and process them too). |
In that case, I think the But I guess this would also break things though... So the current solution is the following : <service id="service.child">
<1-- other services... //-->
<argument type="service" id="logger" />
<tag name="monolog.logger" channel="test" />
</service> Which is to actually not use a service inheritance... |
@Taluu this would be a huge BC break too, as it means that most compiler passes will become unable to use DefinitionDecorator themselves by running after the resolution. |
Mmh so maybe the |
I have an idea how this could be solved |
I don't know if it would be optimized, but maybe if, when not finding any But I think it would kind of be complicated to handle (and I'm not quite sure what it would give performance wise) |
I just ran into this issue which is quite annoying (given I have 7 services extending an abstract one with a |
I just wanted to throw the optimization |
@stof What is your idea? |
Hi.
The channel for logger not activate, if i use DefinitionDecorator instance for create service.
As example:
And after i create a DefinitionDecorator and add monolog.logger tag for this service and inject to container.
The problem in DefinitionDecorator, because here not have a arguments. Argument and another definition options will be processed on
ResolveDefinitionTemplatesPass
(Optimization layer on compiler pass).Maybe add LoggerChannelPass to optimization layer on CompilerPass?:
Thank.
The text was updated successfully, but these errors were encountered: