From 6d0552c954e534e8438388db0c3ca29187926c73 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Mon, 14 Aug 2023 10:47:37 +0200 Subject: [PATCH] Ref for autowiring alias Replaces * https://github.com/symfony/symfony-docs/pull/17051 --- service_container.rst | 4 +++- service_container/autowiring.rst | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/service_container.rst b/service_container.rst index b372ae2b018..fa3681e06f9 100644 --- a/service_container.rst +++ b/service_container.rst @@ -1286,7 +1286,9 @@ admin email. In this case, each needs to have a unique service id: In this case, *two* services are registered: ``site_update_manager.superadmin`` and ``site_update_manager.normal_users``. Thanks to the alias, if you type-hint ``SiteUpdateManager`` the first (``site_update_manager.superadmin``) will be passed. -If you want to pass the second, you'll need to :ref:`manually wire the service `. + +If you want to pass the second, you'll need to :ref:`manually wire the service ` +or to create a named ref:`autowiring alias `. .. caution:: diff --git a/service_container/autowiring.rst b/service_container/autowiring.rst index cd53bbeef35..85b649778bf 100644 --- a/service_container/autowiring.rst +++ b/service_container/autowiring.rst @@ -423,6 +423,8 @@ Additionally, you can define several named autowiring aliases if you want to use one implementation in some cases, and another implementation in some other cases. +.. _autowiring-alias: + For instance, you may want to use the ``Rot13Transformer`` implementation by default when the ``TransformerInterface`` interface is type hinted, but use the ``UppercaseTransformer`` implementation in some