@@ -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 largeBundle or multiple smaller
10- Bundles . Creating a singleBundle has thedraw back that it's impossible for
9+ faced with a choice: either create a single largebundle or multiple smaller
10+ bundles . Creating a singlebundle has thedrawback that it's impossible for
1111users to choose to remove functionality they are not using. Creating multiple
12- Bundles has thedraw back that configuration becomes more tedious and settings
13- often need to be repeated for variousBundles .
12+ bundles has thedrawback that configuration becomes more tedious and settings
13+ often need to be repeated for variousbundles .
1414
1515Using the below approach, it is possible to remove the disadvantage of the
16- multipleBundle approach by enabling a single Extension to prepend the settings
17- for anyBundle . 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+ multiplebundle approach by enabling a single Extension to prepend the settings
17+ for anybundle . 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- multipleBundles . Or it can be used to enable an optional feature that depends
23- on anotherBundle being loaded as well.
22+ multiplebundles . Or it can be used to enable an optional feature that depends
23+ on anotherbundle 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 registeredBundle Extensions. In order to
49- prepend settings to aBundle extension developers can use the
48+ method is called on each of the registeredbundle Extensions. In order to
49+ prepend settings to abundle 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 multipleBundles as well as disable a flag in multipleBundles
57- in case a specific otherBundle is not registered::
56+ a configuration setting in multiplebundles as well as disable a flag in multiplebundles
57+ in case a specific otherbundle is not registered::
5858
5959 public function prepend(ContainerBuilder $container)
6060 {
61- // get allBundles
61+ // get allbundles
6262 $bundles = $container->getParameter('kernel.bundles');
6363 // determine if AcmeGoodbyeBundle is registered
6464 if (!isset($bundles['AcmeGoodbyeBundle'])) {
65- // disable AcmeGoodbyeBundle inBundles
65+ // disable AcmeGoodbyeBundle inbundles
6666 $config = array('use_acme_goodbye' => false);
6767 foreach ($container->getExtensions() as $name => $extension) {
6868 switch ($name) {