Rename mappings to properties maintaining BC

Fixes #407
This commit is contained in:
Tim Nagel 2014-05-25 17:34:44 +10:00
commit c38dc107e7
5 changed files with 74 additions and 41 deletions

View file

@ -175,6 +175,16 @@ class Configuration implements ConfigurationInterface
->useAttributeAsKey('name')
->prototype('array')
->treatNullLike(array())
// BC - Renaming 'mappings' node to 'properties'
->beforeNormalization()
->ifTrue(function($v) { return isset($v['mappings']); })
->then(function($v) {
$v['properties'] = $v['mappings'];
unset($v['mappings']);
return $v;
})
->end()
->children()
->scalarNode('index_analyzer')->end()
->scalarNode('search_analyzer')->end()
@ -182,7 +192,7 @@ class Configuration implements ConfigurationInterface
->append($this->getSerializerNode())
->end()
->append($this->getIdNode())
->append($this->getMappingsNode())
->append($this->getPropertiesNode())
->append($this->getDynamicTemplateNode())
->append($this->getSourceNode())
->append($this->getBoostNode())
@ -198,12 +208,12 @@ class Configuration implements ConfigurationInterface
}
/**
* Returns the array node used for "mappings".
* Returns the array node used for "properties".
*/
protected function getMappingsNode()
protected function getPropertiesNode()
{
$builder = new TreeBuilder();
$node = $builder->root('mappings');
$node = $builder->root('properties');
$nestings = $this->getNestings();