From 49d73c02937a6a5a40d57bd6c8e53e9dfdc4c6fe Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 15 Sep 2025 13:21:39 +0200 Subject: [PATCH] [DependencyInjection] Allow multiple #[AsDecorator] attributes --- service_container/service_decoration.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/service_container/service_decoration.rst b/service_container/service_decoration.rst index e2cadbb0a4b..b04475f2982 100644 --- a/service_container/service_decoration.rst +++ b/service_container/service_decoration.rst @@ -123,6 +123,16 @@ but keeps a reference of the old one as ``.inner``: ->decorate(Mailer::class); }; +.. tip:: + + You can apply multiple ``#[AsDecorator]`` attributes to the same class to + decorate multiple services with it. + + .. versionadded:: 7.4 + + The feature to allow multiple ``#[AsDecorator]`` attributes was introduced + in Symfony 7.4. + The ``decorates`` option tells the container that the ``App\DecoratingMailer`` service replaces the ``App\Mailer`` service. If you're using the :ref:`default services.yaml configuration `,