commit
b2a387580e
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user