You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Most people go over inheritance instead of composition when overwriting services. But the best way would be always go with composition when decorate the service. A maker make:service-decorator could automatically detect the interfaces which a decorated service implements and use so the composition when decorating services and call the inner service e.g.:
An idea i just came to my mind while helping somebody decorate a service correctly, one common issue is also that AsDecorator requires the service id and people are used to write a class in it, there a maker could help with Did you mean service .... In this specific case it was a twig extra extension which only has a service id and not a public class alias in the container.
The text was updated successfully, but these errors were encountered:
WedgeSama
added a commit
to WedgeSama/maker-bundle
that referenced
this issue
Nov 10, 2024
Most people go over inheritance instead of composition when overwriting services. But the best way would be always go with composition when decorate the service. A maker
make:service-decorator
could automatically detect the interfaces which a decorated service implements and use so the composition when decorating services and call the inner service e.g.:Calling
bin/console make:service-decorator
does:An idea i just came to my mind while helping somebody decorate a service correctly, one common issue is also that
AsDecorator
requires the service id and people are used to write a class in it, there a maker could help withDid you mean service ...
. In this specific case it was a twig extra extension which only has a service id and not a public class alias in the container.The text was updated successfully, but these errors were encountered: