Allow bundle to be used without clients or indexes defined.

This commit is contained in:
Tim Nagel 2013-12-15 18:33:31 +11:00
parent 6c4740b292
commit e2e21b1e0c

View file

@ -24,12 +24,14 @@ class FOSElasticaExtension extends Extension
$config = $this->processConfiguration($configuration, $configs);
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('config.xml');
if (empty($config['clients']) || empty($config['indexes'])) {
throw new InvalidArgumentException('You must define at least one client and one index');
// No Clients or indexes are defined
return;
}
$loader->load('config.xml');
if (empty($config['default_client'])) {
$keys = array_keys($config['clients']);
$config['default_client'] = reset($keys);