Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitce16301

Browse files
[DependencyInjection] Add #[Autoconfigure] and #[AutoconfigureTag] documentation
1 parent6806543 commitce16301

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

‎service_container/tags.rst‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,29 @@ If you want to apply tags automatically for your own services, use the
117117
->tag('app.custom_tag');
118118
};
119119
120+
It is also possible to use the ``#[AutoconfigureTag]`` attribute directly on the
121+
base class or interface::
122+
123+
// src/Security/CustomInterface.php
124+
namespace App\Security;
125+
126+
use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag;
127+
128+
#[AutoconfigureTag('app.custom_tag')]
129+
interface CustomInterface
130+
{
131+
// ...
132+
}
133+
134+
..tip::
135+
136+
If you need more capabilities to autoconfigure instances of your base class
137+
like their laziness, their bindings or their calls for example, you may rely
138+
on the:class:`Symfony\\Component\\DependencyInjection\\Attribute\\Autoconfigure` attribute.
139+
140+
..versionadded::5.3
141+
142+
The ``#[Autoconfigure]`` and ``#[AutoconfigureTag]`` attributes were introduced in Symfony 5.3.
120143

121144
For more advanced needs, you can define the automatic tags using the
122145
:method:`Symfony\\Component\\DependencyInjection\\ContainerBuilder::registerForAutoconfiguration` method.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp