Merge pull request #453 from pentarim/master

adding ttl for documents
This commit is contained in:
Tim Nagel 2014-01-30 13:42:09 -08:00
commit 82e9809ceb
2 changed files with 24 additions and 0 deletions

View file

@ -299,6 +299,7 @@ class Configuration implements ConfigurationInterface
->append($this->getParentNode())
->append($this->getAllNode())
->append($this->getTimestampNode())
->append($this->getTtlNode())
->end()
;
@ -669,4 +670,24 @@ class Configuration implements ConfigurationInterface
return $node;
}
/**
* Returns the array node used for "_ttl"
*/
protected function getTtlNode()
{
$builder = new TreeBuilder();
$node = $builder->root('_ttl');
$node
->children()
->scalarNode('enabled')->defaultValue(true)->end()
->scalarNode('default')->end()
->scalarNode('store')->end()
->scalarNode('index')->end()
->end()
;
return $node;
}
}

View file

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