private function AddIdentityPrimaryKeyMapping(IDataPropertyColumnMapping $PropertyMapping) { //Infer primary key table $AllColumns = array_merge($PropertyMapping->GetPersistColumns(), $PropertyMapping->GetReviveColumns()); if ($this->PrimaryKeyTable === null) { $this->PrimaryKeyTable = reset($AllColumns)->GetTable(); } foreach ($AllColumns as $Column) { if (!$Column->GetTable()->Is($this->PrimaryKeyTable)) { throw new MappingException('Identity properties of %s cannot map across multiple tables: %s.%s does not belong to %s', $this->EntityType, $Column->GetTable()->GetName(), $Column->GetName(), $this->PrimaryKeyTable->GetName()); } } $this->IdentityPropertyPrimaryKeyMappings[] = $PropertyMapping; }