File tree 1 file changed +7
-18
lines changed
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::
155
155
}
156
156
}
157
157
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::
176
160
177
161
// ...
178
162
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -190,6 +174,11 @@ or if you are following the recommended way for new bundles and for bundles foll
190
174
}
191
175
}
192
176
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
+
193
182
Autoconfiguration registering is not limited to interfaces. It is possible
194
183
to use PHP attributes to autoconfigure services by using the
195
184
:method: `Symfony\\ Component\\ DependencyInjection\\ ContainerBuilder::registerAttributeForAutoconfiguration `
You can’t perform that action at this time.
0 commit comments