File tree 1 file changed +19
-0
lines changed
1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -171,6 +171,25 @@ In a Symfony bundle, call this method in the ``load()`` method of the
171
171
}
172
172
}
173
173
174
+ or if you are following the recommended way for new bundles and for bundles following the
175
+ :ref: `recommended directory structure <bundles-directory-structure >`::
176
+
177
+ // ...
178
+ use Symfony\Component\DependencyInjection\ContainerBuilder;
179
+ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
180
+ use Symfony\Component\HttpKernel\Bundle\AbstractBundle;
181
+
182
+ class MyBundle extends AbstractBundle
183
+ {
184
+ public function loadExtension(array $config, ContainerConfigurator $container, ContainerBuilder $builder): void
185
+ {
186
+ $builder
187
+ ->registerForAutoconfiguration(CustomInterface::class)
188
+ ->addTag('app.custom_tag')
189
+ ;
190
+ }
191
+ }
192
+
174
193
Autoconfiguration registering is not limited to interfaces. It is possible
175
194
to use PHP attributes to autoconfigure services by using the
176
195
:method: `Symfony\\ Component\\ DependencyInjection\\ ContainerBuilder::registerAttributeForAutoconfiguration `
You can’t perform that action at this time.
0 commit comments