@@ -6,21 +6,21 @@ How to simplify configuration of multiple Bundles
66=================================================
77
88When building reusable and extensible applications, developers are often
9- faced with a choice: either create a single large Bundle or multiple smaller
10- Bundles . Creating a single Bundle has the draw back that it's impossible for
9+ faced with a choice: either create a single large bundle or multiple smaller
10+ bundles . Creating a single bundle has the drawback that it's impossible for
1111users to choose to remove functionality they are not using. Creating multiple
12- Bundles has the draw back that configuration becomes more tedious and settings
13- often need to be repeated for various Bundles .
12+ bundles has the drawback that configuration becomes more tedious and settings
13+ often need to be repeated for various bundles .
1414
1515Using the below approach, it is possible to remove the disadvantage of the
16- multiple Bundle approach by enabling a single Extension to prepend the settings
17- for any Bundle . It can use the settings defined in the ``app/config/config.yml ``
18- to prepend settings just as if they would have been written explicitly by the
19- user in the application configuration.
16+ multiple bundle approach by enabling a single Extension to prepend the settings
17+ for any bundle . It can use the settings defined in the ``app/config/config.yml ``
18+ to prepend settings just as if they would have been written explicitly by
19+ the user in the application configuration.
2020
2121For example, this could be used to configure the entity manager name to use in
22- multiple Bundles . Or it can be used to enable an optional feature that depends
23- on another Bundle being loaded as well.
22+ multiple bundles . Or it can be used to enable an optional feature that depends
23+ on another bundle being loaded as well.
2424
2525To give an Extension the power to do this, it needs to implement
2626:class: `Symfony\\ Component\\ DependencyInjection\\ Extension\\ PrependExtensionInterface `::
@@ -45,24 +45,24 @@ To give an Extension the power to do this, it needs to implement
4545Inside the :method: `Symfony\\ Component\\ DependencyInjection\\ Extension\\ PrependExtensionInterface::prepend `
4646method, developers have full access to the :class: `Symfony\\ Component\\ DependencyInjection\\ ContainerBuilder `
4747instance just before the :method: `Symfony\\ Component\\ DependencyInjection\\ Extension\\ ExtensionInterface::load `
48- method is called on each of the registered Bundle Extensions. In order to
49- prepend settings to a Bundle extension developers can use the
48+ method is called on each of the registered bundle Extensions. In order to
49+ prepend settings to a bundle extension developers can use the
5050:method: `Symfony\\ Component\\ DependencyInjection\\ ContainerBuilder::prependExtensionConfig `
5151method on the :class: `Symfony\\ Component\\ DependencyInjection\\ ContainerBuilder `
5252instance. As this method only prepends settings, any other settings done explicitly
5353inside the ``app/config/config.yml `` would override these prepended settings.
5454
5555The following example illustrates how to prepend
56- a configuration setting in multiple Bundles as well as disable a flag in multiple Bundles
57- in case a specific other Bundle is not registered::
56+ a configuration setting in multiple bundles as well as disable a flag in multiple bundles
57+ in case a specific other bundle is not registered::
5858
5959 public function prepend(ContainerBuilder $container)
6060 {
61- // get all Bundles
61+ // get all bundles
6262 $bundles = $container->getParameter('kernel.bundles');
6363 // determine if AcmeGoodbyeBundle is registered
6464 if (!isset($bundles['AcmeGoodbyeBundle'])) {
65- // disable AcmeGoodbyeBundle in Bundles
65+ // disable AcmeGoodbyeBundle in bundles
6666 $config = array('use_acme_goodbye' => false);
6767 foreach ($container->getExtensions() as $name => $extension) {
6868 switch ($name) {
0 commit comments