private function AddPropertyMapping(IPropertyMapping $PropertyMapping)
{
$ProperyIdentifier = $PropertyMapping->GetProperty()->GetIdentifier();
if ($PropertyMapping instanceof IDataPropertyColumnMapping) {
$this->DataPropertyColumnMappings[$ProperyIdentifier] = $PropertyMapping;
$this->MappedReviveColumns = array_merge($this->MappedReviveColumns, $PropertyMapping->GetReviveColumns());
$this->MappedPersistColumns = array_merge($this->MappedPersistColumns, $PropertyMapping->GetPersistColumns());
if ($PropertyMapping->IsIdentityPrimaryKeyMapping()) {
$this->AddIdentityPrimaryKeyMapping($PropertyMapping);
}
} else {
if ($PropertyMapping instanceof IEntityPropertyToOneRelationMapping) {
$this->EntityPropertyToOneRelationMappings[$ProperyIdentifier] = $PropertyMapping;
} else {
if ($PropertyMapping instanceof ICollectionPropertyToManyRelationMapping) {
$this->CollectionPropertyToManyRelationMappings[$ProperyIdentifier] = $PropertyMapping;
} else {
throw new MappingException('Supplied property mapping must be of type %s, %s or %s: %s given', IDataPropertyColumnMapping::IDataPropertyColumnMappingType, IEntityPropertyToOneRelationMapping::IEntityPropertyToOneRelationMappingType, ICollectionPropertyToManyRelationMapping::ICollectionPropertyToManyRelationMappingType, get_class($PropertyMapping));
}
}
}
$this->MappedProperties[$ProperyIdentifier] = $PropertyMapping->GetProperty();
$this->PropertyMappings[$ProperyIdentifier] = $PropertyMapping;
}