From 52aee8185e943cbe759c62f39698f78d6c7af055 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Wed, 30 Aug 2023 11:38:11 +0200 Subject: [PATCH] [DependencyInjection] Allow loading and dumping tags with an attribute named "name" --- service_container/tags.rst | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/service_container/tags.rst b/service_container/tags.rst index 87f354434c2..c6ed02067e7 100644 --- a/service_container/tags.rst +++ b/service_container/tags.rst @@ -515,6 +515,45 @@ To answer this, change the service declaration: ; }; +.. tip:: + + In XML and YAML format, you may provide the tag an attribute called ``name``. + When doing so, this is the syntax you should follow: + + .. configuration-block:: + + .. code-block:: yaml + + # config/services.yaml + services: + MailerSmtpTransport: + arguments: ['%mailer_host%'] + tags: + - app.mail_transport: { name: 'arbitrary-value', alias: 'smtp' } + + .. code-block:: xml + + + + + + + + %mailer_host% + + app.mail_transport + + + + + .. versionadded:: 5.1 + + The possibility to add the ``name`` attribute to a tag in XML and YAML + formats was introduced in Symfony 5.1. + .. tip:: In YAML format, you may provide the tag as a simple string as long as