Adding support for enabling timestamps

This commit is contained in:
Lea Haensenberger 2014-01-06 09:20:44 +01:00
parent d33c5d0ece
commit 4ee81dc010
2 changed files with 23 additions and 0 deletions

View file

@ -299,6 +299,7 @@ class Configuration implements ConfigurationInterface
->append($this->getRoutingNode())
->append($this->getParentNode())
->append($this->getAllNode())
->append($this->getTimestampNode())
->end()
;
@ -647,4 +648,23 @@ class Configuration implements ConfigurationInterface
return $node;
}
/**
* Returns the array node used for "_timestamp"
*/
protected function getTimestampNode()
{
$builder = new TreeBuilder();
$node = $builder->root('_timestamp');
$node
->children()
->scalarNode('enabled')->defaultValue(true)->end()
->scalarNode('path')->end()
->scalarNode('format')->end()
->end()
;
return $node;
}
}

View file

@ -246,6 +246,9 @@ class FOSElasticaExtension extends Extension
if (isset($type['_all'])) {
$this->indexConfigs[$indexName]['config']['mappings'][$name]['_all'] = $type['_all'];
}
if (isset($type['_timestamp'])) {
$this->indexConfigs[$indexName]['config']['mappings'][$name]['_timestamp'] = $type['_timestamp'];
}
if (!empty($type['dynamic_templates'])) {
$this->indexConfigs[$indexName]['config']['mappings'][$name]['dynamic_templates'] = array();
foreach ($type['dynamic_templates'] as $templateName => $templateData) {