/** * Stores the association mapping. * * @param AssociationMapping $assocMapping */ protected function _storeAssociationMapping(AssociationMapping $assocMapping) { $sourceFieldName = $assocMapping->sourceFieldName; if (isset($this->fieldMappings[$sourceFieldName]) || isset($this->associationMappings[$sourceFieldName])) { throw MappingException::duplicateFieldMapping($this->name, $sourceFieldName); } $this->associationMappings[$sourceFieldName] = $assocMapping; $this->_registerMappingIfInverse($assocMapping); }
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; }