This commit is contained in:
Lukas Kahwe Smith 2013-05-17 00:22:46 +02:00
parent 814460dbf2
commit 50730cca3d
2 changed files with 21 additions and 0 deletions

View file

@ -281,6 +281,7 @@ class Configuration implements ConfigurationInterface
->end()
->end()
->end()
->append($this->getIdNode())
->append($this->getMappingsNode())
->append($this->getSourceNode())
->append($this->getBoostNode())
@ -435,6 +436,23 @@ class Configuration implements ConfigurationInterface
$nestings[$property] = array_merge_recursive($nestings[$property], $this->getNestingsForType($field[$property]));
}
/**
* Returns the array node used for "_id".
*/
protected function getIdNode()
{
$builder = new TreeBuilder();
$node = $builder->root('_id');
$node
->children()
->scalarNode('path')->end()
->end()
;
return $node;
}
/**
* Returns the array node used for "_source".
*/

View file

@ -197,6 +197,9 @@ class FOSElasticaExtension extends Extension
$typeDef->addMethodCall('setSerializer', array(array(new Reference($callbackId), 'serialize')));
}
$container->setDefinition($typeId, $typeDef);
if (isset($type['_id'])) {
$this->indexConfigs[$indexName]['config']['mappings'][$name]['_id'] = $type['_id'];
}
if (isset($type['_source'])) {
$this->indexConfigs[$indexName]['config']['mappings'][$name]['_source'] = $type['_source'];
}