Skip to content

Commit 5702a9b

Browse files
Updating to remove HTTPKernel specific method from di config processing examples
1 parent 7c69432 commit 5702a9b

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

components/dependency_injection/compilation.rst

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,14 @@ to use :doc:`the Config Component</components/config/introduction>` to merge
140140
and validate the config values. Using the configuration processing you could
141141
access the config value this way::
142142

143+
use Symfony\Component\Config\Definition\Processor;
144+
//--
145+
143146
public function load(array $configs, ContainerBuilder $container)
144147
{
145148
$configuration = new Configuration();
146-
$config = $this->processConfiguration($configuration, $configs);
149+
$processor = new Processor();
150+
$config = $processor->processConfiguration($configuration, $configs);
147151

148152
$foo = $config['foo']; //fooValue
149153
$bar = $config['bar']; //barValue
@@ -185,8 +189,8 @@ The XML version of the config would then look like this:
185189
186190
..note::
187191
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.
190194

191195
The processed config value can now be added as container parameters as if they were
192196
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::
195199
public function load(array $configs, ContainerBuilder $container)
196200
{
197201
$configuration = new Configuration();
198-
$config = $this->processConfiguration($configuration, $configs);
202+
$processor = new Processor();
203+
$config = $processor->processConfiguration($configuration, $configs);
199204

200205
$container->setParameter('acme_demo.FOO', $config['foo'])
201206

@@ -209,7 +214,8 @@ but also load a secondary one only if a certain parameter is set::
209214
public function load(array $configs, ContainerBuilder $container)
210215
{
211216
$configuration = new Configuration();
212-
$config = $this->processConfiguration($configuration, $configs);
217+
$processor = new Processor();
218+
$config = $processor->processConfiguration($configuration, $configs);
213219

214220
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
215221
$loader->load('services.xml');

0 commit comments

Comments
 (0)