docs
docs copied to clipboard
Explain how multiple modules can decorate same Symfony service
foo:
class: App\Foo
arguments: ['@router']
public: true
foo_decorated1:
class: App\DecorFooOne
decorates: foo
arguments: ['@foo_decorated1.inner']
public: true
foo_decorated2:
class: App\DecorFooTwo
decorates: foo
arguments: ['@foo_decorated2.inner']
public: true
Constructor of DecorFooTwo will receive an instance of DecorFooOne, not Foo. Symfony is able to chain decoration links.
This means that if multiple modules decorate the same Core service, all the behaviors will be kept (instead of one module overriding others behaviors).