mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 18:48:51 +02:00
N°977 DataSynchro: Creation and edition was broken due to the new object set API from ormLinkSet.
Backward compatible method have been introduce to ensure plugins and modules compatibility. That being said they are already flagged as deprecated and should not be used. New: Using those deprecated methods will raise a PHP deprecated error. SVN:trunk[4878]
This commit is contained in:
@@ -127,6 +127,18 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator
|
||||
$this->bHasDelta = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DBObject $oObject
|
||||
* @param string $sClassAlias
|
||||
* @deprecated
|
||||
*/
|
||||
public function AddObject(DBObject $oObject, $sClassAlias = '')
|
||||
{
|
||||
trigger_error('iTop: ormLinkSet::AddObject() is deprecated use ormLinkSet::AddItem() instead.', E_USER_DEPRECATED);
|
||||
|
||||
$this->AddItem($oObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $iObjectId
|
||||
*/
|
||||
@@ -177,7 +189,33 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Note: After calling this method, the set cursor will be at the end of the set. You might to rewind it.
|
||||
*
|
||||
* @param bool $bWithId
|
||||
* @return array
|
||||
* @deprecated
|
||||
*/
|
||||
public function ToArray($bWithId = true)
|
||||
{
|
||||
trigger_error('iTop: ormLinkSet::ToArray() is deprecated use foreach instead.', E_USER_DEPRECATED);
|
||||
|
||||
$aRet = array();
|
||||
foreach($this as $oItem)
|
||||
{
|
||||
if ($bWithId)
|
||||
{
|
||||
$aRet[$oItem->GetKey()] = $oItem;
|
||||
}
|
||||
else
|
||||
{
|
||||
$aRet[] = $oItem;
|
||||
}
|
||||
}
|
||||
return $aRet;
|
||||
}
|
||||
|
||||
/**
|
||||
* The class of the objects of the collection (at least a common ancestor)
|
||||
*
|
||||
* @return string
|
||||
|
||||
@@ -560,7 +560,7 @@ EOF
|
||||
elseif ($oAttribute instanceof SynchroAttLinkSet)
|
||||
{
|
||||
}
|
||||
$oAttributeSet->AddObject($oAttribute);
|
||||
$oAttributeSet->AddItem($oAttribute);
|
||||
}
|
||||
$this->Set('attribute_list', $oAttributeSet);
|
||||
}
|
||||
@@ -648,12 +648,11 @@ EOF
|
||||
|
||||
if (!is_null($oAttribute))
|
||||
{
|
||||
$oAttribute->Set('sync_source_id', $this->GetKey());
|
||||
$oAttribute->Set('attcode', $sAttCode);
|
||||
$oAttribute->Set('reconcile', MetaModel::IsReconcKey($this->GetTargetClass(), $sAttCode) ? 1 : 0);
|
||||
$oAttribute->Set('update', 1);
|
||||
$oAttribute->Set('update_policy', 'master_locked');
|
||||
$oAttributeSet->AddObject($oAttribute);
|
||||
$oAttributeSet->AddItem($oAttribute);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -677,9 +676,8 @@ EOF
|
||||
if ($this->Get('reconciliation_policy') == 'use_attributes')
|
||||
{
|
||||
$oSet = $this->Get('attribute_list');
|
||||
$oSynchroAttributeList = $oSet->ToArray();
|
||||
$bReconciliationKey = false;
|
||||
foreach($oSynchroAttributeList as $oSynchroAttribute)
|
||||
foreach($oSet as $oSynchroAttribute)
|
||||
{
|
||||
if ($oSynchroAttribute->Get('reconcile') == 1)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user