/** * INTERNAL: * Adds an association mapping without completing/validating it. * This is mainly used to add inherited association mappings to derived classes. * * @param AssociationMapping $mapping * @param string $owningClassName The name of the class that defined this mapping. * @todo Rename: addInheritedAssociationMapping */ public function addAssociationMapping(AssociationMapping $mapping, $owningClassName = null) { $sourceFieldName = $mapping->sourceFieldName; if (isset($this->associationMappings[$sourceFieldName])) { throw MappingException::duplicateAssociationMapping($this->name, $sourceFieldName); } $this->associationMappings[$sourceFieldName] = $mapping; if ($owningClassName !== null) { $this->inheritedAssociationFields[$sourceFieldName] = $owningClassName; } $this->_registerMappingIfInverse($mapping); }
/** * INTERNAL: * Adds an association mapping without completing/validating it. * This is mainly used to add inherited association mappings to derived classes. * * @param AssociationMapping $mapping * @param string $owningClassName The name of the class that defined this mapping. */ public function addInheritedAssociationMapping(AssociationMapping $mapping) { if (isset($this->associationMappings[$mapping->sourceFieldName])) { throw MappingException::duplicateAssociationMapping($this->name, $mapping->sourceFieldName); } $this->associationMappings[$mapping->sourceFieldName] = $mapping; }