protected function validateAndCompleteFieldMapping($mapping)
{
if (!isset($mapping['fieldName']) || !$mapping['fieldName']) {
throw new MappingException("Mapping a property requires to specify the name.");
}
if (!isset($mapping['jsonName'])) {
$mapping['jsonName'] = $mapping['fieldName'];
}
if (isset($this->fieldMappings[$mapping['fieldName']]) || isset($this->associationsMappings[$mapping['fieldName']])) {
throw MappingException::duplicateFieldMapping($this->name, $mapping['fieldName']);
}
return $mapping;
}