@@ -140,10 +140,14 @@ to use :doc:`the Config Component</components/config/introduction>` to merge
140
140
and validate the config values. Using the configuration processing you could
141
141
access the config value this way::
142
142
143
+ use Symfony\Component\Config\Definition\Processor;
144
+ //--
145
+
143
146
public function load(array $configs, ContainerBuilder $container)
144
147
{
145
148
$configuration = new Configuration();
146
- $config = $this->processConfiguration($configuration, $configs);
149
+ $processor = new Processor();
150
+ $config = $processor->processConfiguration($configuration, $configs);
147
151
148
152
$foo = $config['foo']; //fooValue
149
153
$bar = $config['bar']; //barValue
@@ -185,8 +189,8 @@ The XML version of the config would then look like this:
185
189
186
190
..note::
187
191
In the Symfony2 full stack framework there is a base Extension class which
188
- implements these methods. See :doc:`/cookbook/bundles/extension` for
189
- more details.
192
+ implements these methods as well as a short cut method for processing the
193
+ configuration. See :doc:`/cookbook/bundles/extension` for more details.
190
194
191
195
The processed config value can now be added as container parameters as if they were
192
196
listed in a ``parameters `` section of the config file but with merging multiple files
@@ -195,7 +199,8 @@ and validation of the configuration thrown in::
195
199
public function load(array $configs, ContainerBuilder $container)
196
200
{
197
201
$configuration = new Configuration();
198
- $config = $this->processConfiguration($configuration, $configs);
202
+ $processor = new Processor();
203
+ $config = $processor->processConfiguration($configuration, $configs);
199
204
200
205
$container->setParameter('acme_demo.FOO', $config['foo'])
201
206
@@ -209,7 +214,8 @@ but also load a secondary one only if a certain parameter is set::
209
214
public function load(array $configs, ContainerBuilder $container)
210
215
{
211
216
$configuration = new Configuration();
212
- $config = $this->processConfiguration($configuration, $configs);
217
+ $processor = new Processor();
218
+ $config = $processor->processConfiguration($configuration, $configs);
213
219
214
220
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
215
221
$loader->load('services.xml');
0 commit comments