Changed configuration to implement ConfigurationInterface
This commit is contained in:
parent
904a664dfe
commit
3f93f93a45
2 changed files with 18 additions and 11 deletions
|
|
@ -4,8 +4,9 @@ namespace FOQ\ElasticaBundle\DependencyInjection;
|
|||
|
||||
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
|
||||
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
||||
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
||||
|
||||
class Configuration
|
||||
class Configuration implements ConfigurationInterface
|
||||
{
|
||||
private $supportedDrivers = array('orm', 'mongodb', 'propel');
|
||||
|
||||
|
|
@ -16,11 +17,9 @@ class Configuration
|
|||
}
|
||||
|
||||
/**
|
||||
* Generates the configuration tree.
|
||||
*
|
||||
* @return \Symfony\Component\DependencyInjection\Configuration\NodeInterface
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getConfigTree()
|
||||
public function getConfigTreeBuilder()
|
||||
{
|
||||
$treeBuilder = new TreeBuilder();
|
||||
$rootNode = $treeBuilder->root('foq_elastica', 'array');
|
||||
|
|
@ -36,7 +35,17 @@ class Configuration
|
|||
->end()
|
||||
;
|
||||
|
||||
return $treeBuilder->buildTree();
|
||||
return $treeBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the configuration tree.
|
||||
*
|
||||
* @return \Symfony\Component\DependencyInjection\Configuration\NodeInterface
|
||||
*/
|
||||
public function getConfigTree()
|
||||
{
|
||||
return $this->getConfigTreeBuilder()->buildTree();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -445,7 +454,7 @@ class Configuration
|
|||
|
||||
return $node;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the array node used for "_routing".
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace FOQ\ElasticaBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\Config\Definition\Processor;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
|
@ -21,8 +20,7 @@ class FOQElasticaExtension extends Extension
|
|||
public function load(array $configs, ContainerBuilder $container)
|
||||
{
|
||||
$configuration = $this->getConfiguration($configs, $container);
|
||||
$processor = new Processor();
|
||||
$config = $processor->process($configuration->getConfigTree(), $configs);
|
||||
$config = $this->processConfiguration($configuration, $configs);
|
||||
|
||||
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||
$loader->load('config.xml');
|
||||
|
|
@ -381,7 +379,7 @@ class FOQElasticaExtension extends Extension
|
|||
$finderDef->replaceArgument(1, new Reference($elasticaToModelId));
|
||||
$container->setDefinition($finderId, $finderDef);
|
||||
}
|
||||
|
||||
|
||||
$managerId = sprintf('foq_elastica.manager.%s', $typeConfig['driver']);
|
||||
$managerDef = $container->getDefinition($managerId);
|
||||
$arguments = array( $typeConfig['model'], new Reference($finderId));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue