File tree Expand file tree Collapse file tree 1 file changed +7
-18
lines changed Expand file tree Collapse file tree 1 file changed +7
-18
lines changed Original file line number Diff line number Diff line change @@ -155,24 +155,8 @@ In a Symfony application, call this method in your kernel class::
155155 }
156156 }
157157
158- In a Symfony bundle, call this method in the ``load() `` method of the
159- :doc: `bundle extension class </bundles/extension >`::
160-
161- // src/DependencyInjection/MyBundleExtension.php
162- class MyBundleExtension extends Extension
163- {
164- // ...
165-
166- public function load(array $configs, ContainerBuilder $container): void
167- {
168- $container->registerForAutoconfiguration(CustomInterface::class)
169- ->addTag('app.custom_tag')
170- ;
171- }
172- }
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 >`::
158+ In bundles extending the :class: `Symfony\\ Component\\ HttpKernel\\ Bundle\\ AbstractBundle `
159+ class, call this method in the ``loadExtension() `` method of the main bundle class::
176160
177161 // ...
178162 use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -190,6 +174,11 @@ or if you are following the recommended way for new bundles and for bundles foll
190174 }
191175 }
192176
177+ .. note ::
178+
179+ For bundles not extending the ``AbstractBundle `` class, call this method in
180+ the ``load() `` method of the :doc: `bundle extension class </bundles/extension >`.
181+
193182Autoconfiguration registering is not limited to interfaces. It is possible
194183to use PHP attributes to autoconfigure services by using the
195184:method: `Symfony\\ Component\\ DependencyInjection\\ ContainerBuilder::registerAttributeForAutoconfiguration `
You can’t perform that action at this time.
0 commit comments