Merge pull request #207 from Exercise/index-aliasing

Adding configuring index name separately from service name
This commit is contained in:
Richard Miller 2013-02-03 11:32:37 -08:00
commit 94d89159bd
2 changed files with 3 additions and 1 deletions

View file

@ -102,6 +102,7 @@ class Configuration
->prototype('array')
->performNoDeepMerging()
->children()
->scalarNode('index_name')->end()
->scalarNode('client')->end()
->scalarNode('finder')
->treatNullLike(true)

View file

@ -100,7 +100,8 @@ class FOQElasticaExtension extends Extension
$clientId = $clientIdsByName[$clientName];
$indexId = sprintf('foq_elastica.index.%s', $name);
$indexDefArgs = array($name);
$indexName = isset($index['index_name']) ? $index['index_name'] : $name;
$indexDefArgs = array($indexName);
$indexDef = new Definition('%foq_elastica.index.class%', $indexDefArgs);
$indexDef->setFactoryService($clientId);
$indexDef->setFactoryMethod('getIndex');