Could not add more than one link between a given server and a given network device. This is a regression in 2.2.0 beta. This issue affect N-N links where duplicates are allowed. One single link is being affected in the standard datamodel.

SVN:trunk[3745]
This commit is contained in:
Romain Quetiez
2015-09-11 12:03:22 +00:00
parent 33762796b8
commit f26bcd812c
2 changed files with 14 additions and 3 deletions

View File

@@ -1135,8 +1135,18 @@ class AttributeLinkedSet extends AttributeDefinition
return false;
}
// Both values are Object sets
return $val1->HasSameContents($val2);
// Note: maintain this algorithm so as to make sure it is strictly equivalent to the one used within DBObject::DBWriteLinks()
$sExtKeyToMe = $this->GetExtKeyToMe();
$sAdditionalKey = null;
if ($this->IsIndirect() && !$this->DuplicatesAllowed())
{
$sAdditionalKey = $this->GetExtKeyToRemote();
}
$oComparator = new DBObjectSetComparator($val1, $val2, array($sExtKeyToMe), $sAdditionalKey);
$aChanges = $oComparator->GetDifferences();
$bAreEquivalent = (count($aChanges['added']) == 0) && (count($aChanges['removed']) == 0) && (count($aChanges['modified']) == 0);
return $bAreEquivalent;
}
/**

View File

@@ -1366,9 +1366,10 @@ abstract class DBObject implements iDisplay
if (!array_key_exists($sAttCode, $this->m_aTouchedAtt)) continue;
if (array_key_exists($sAttCode, $this->m_aModifiedAtt) && ($this->m_aModifiedAtt[$sAttCode] == false)) continue;
// Note: any change to this algorithm must be reproduced into the implementation of AttributeLinkSet::Equals()
$sExtKeyToMe = $oAttDef->GetExtKeyToMe();
$sAdditionalKey = null;
if ($oAttDef->IsIndirect())
if ($oAttDef->IsIndirect() && !$oAttDef->DuplicatesAllowed())
{
$sAdditionalKey = $oAttDef->GetExtKeyToRemote();
}