diff --git a/service_container/service_decoration.rst b/service_container/service_decoration.rst index c9de48976d9..7dd497e1758 100644 --- a/service_container/service_decoration.rst +++ b/service_container/service_decoration.rst @@ -84,10 +84,14 @@ but keeps a reference of the old one as ``App\DecoratingMailer.inner``: + + @@ -103,9 +107,13 @@ but keeps a reference of the old one as ``App\DecoratingMailer.inner``: $container->register(Mailer::class); + // overrides the AppBundle\Mailer service + // but that service is still available as AppBundle\DecoratingMailer.inner $container->register(DecoratingMailer::class) ->setDecoratedService(Mailer::class) + // pass the old service as an argument ->addArgument(new Reference(DecoratingMailer::class.'.inner')) + // private, because usually you do not need to fetch AppBundle\DecoratingMailer directly ->setPublic(false) ;