protected function getRootMapping($mappings)
{
$properties = array();
foreach ($mappings as $rootMapping) {
$propertyName = $rootMapping['fieldName'];
$mapping = array();
if (isset($rootMapping['value'])) {
$mapping = $rootMapping['value'];
}
if (isset($rootMapping['match'])) {
$mapping['match'] = $rootMapping['match'];
}
if (isset($rootMapping['pathMatch'])) {
$mapping['path_match'] = $rootMapping['pathMatch'];
}
if (isset($rootMapping['unmatch'])) {
$mapping['unmatch'] = $rootMapping['unmatch'];
}
if (isset($rootMapping['pathUnmatch'])) {
$mapping['path_unmatch'] = $rootMapping['pathUnmatch'];
}
if (isset($rootMapping['matchPattern'])) {
$mapping['match_pattern'] = $rootMapping['matchPattern'];
}
if (isset($rootMapping['matchMappingType'])) {
$mapping['match_mapping_type'] = $rootMapping['matchMappingType'];
}
if (isset($rootMapping['mapping'])) {
$mapping['mapping'] = current($this->getMapping(array($rootMapping['mapping'])));
}
if (isset($rootMapping['id'])) {
$properties[$propertyName][][$rootMapping['id']] = $mapping;
} else {
$properties[$propertyName] = $mapping;
}
}
return $properties;
}