Merge pull request #85 from kbond/config-dump

Enable dumping of config
This commit is contained in:
Leszek Prabucki 2014-06-03 10:09:31 +02:00
commit b2a387580e

View File

@ -28,21 +28,15 @@ class KnpGaufretteExtension extends Extension
public function load(array $configs, ContainerBuilder $container)
{
$processor = new Processor();
// first assemble the adapter factories
$factoryConfig = new FactoryConfiguration();
$config = $processor->processConfiguration($factoryConfig, $configs);
$factories = $this->createAdapterFactories($config, $container);
// then normalize the configs
$mainConfig = new MainConfiguration($factories);
$config = $processor->processConfiguration($mainConfig, $configs);
$config = $processor->processConfiguration($this->getConfiguration($configs, $container), $configs);
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('gaufrette.xml');
$adapters = array();
foreach ($config['adapters'] as $name => $adapter) {
$adapters[$name] = $this->createAdapter($name, $adapter, $container, $factories);
$adapters[$name] = $this->createAdapter($name, $adapter, $container, $this->factories);
}
$map = array();
@ -59,6 +53,19 @@ class KnpGaufretteExtension extends Extension
}
}
public function getConfiguration(array $configs, ContainerBuilder $container)
{
$processor = new Processor();
// first assemble the adapter factories
$factoryConfig = new FactoryConfiguration();
$config = $processor->processConfiguration($factoryConfig, $configs);
$factories = $this->createAdapterFactories($config, $container);
// then normalize the configs
return new MainConfiguration($factories);
}
private function createAdapter($name, array $config, ContainerBuilder $container, array $factories)
{
$adapter = null;