diff --git a/core/dbobject.class.php b/core/dbobject.class.php index 436aed85d..78324b0a1 100644 --- a/core/dbobject.class.php +++ b/core/dbobject.class.php @@ -4362,72 +4362,6 @@ abstract class DBObject implements iDisplay return array(); } - /** - * Use GetRelatedObjectsDown/Up instead to take redundancy into account - * - * @internal - * @deprecated - */ - public function GetRelatedObjects($sRelCode, $iMaxDepth = 99, &$aResults = array()) - { - // Temporary patch: until the impact analysis GUI gets rewritten, - // let's consider that "depends on" is equivalent to "impacts/up" - // The current patch has been implemented in DBObject and MetaModel - $sHackedRelCode = $sRelCode; - $bDown = true; - if ($sRelCode == 'depends on') - { - $sHackedRelCode = 'impacts'; - $bDown = false; - } - foreach (MetaModel::EnumRelationQueries(get_class($this), $sHackedRelCode, $bDown) as $sDummy => $aQueryInfo) - { - $sQuery = $bDown ? $aQueryInfo['sQueryDown'] : $aQueryInfo['sQueryUp']; - //$bPropagate = $aQueryInfo["bPropagate"]; - //$iDepth = $bPropagate ? $iMaxDepth - 1 : 0; - $iDepth = $iMaxDepth - 1; - - // Note: the loop over the result set has been written in an unusual way for error reporting purposes - // In the case of a wrong query parameter name, the error occurs on the first call to Fetch, - // thus we need to have this first call into the try/catch, but - // we do NOT want to nest the try/catch for the error message to be clear - try - { - $oFlt = DBObjectSearch::FromOQL($sQuery); - $oObjSet = new DBObjectSet($oFlt, array(), $this->ToArgsForQuery()); - $oObj = $oObjSet->Fetch(); - } - catch (Exception $e) - { - $sClassOfDefinition = $aQueryInfo['_legacy_'] ? get_class($this).'(or a parent)::GetRelationQueries()' : $aQueryInfo['sDefinedInClass']; - throw new Exception("Wrong query for the relation $sRelCode/$sClassOfDefinition/{$aQueryInfo['sNeighbour']}: ".$e->getMessage()); - } - if ($oObj) - { - do - { - $sRootClass = MetaModel::GetRootClass(get_class($oObj)); - $sObjKey = $oObj->GetKey(); - if (array_key_exists($sRootClass, $aResults)) - { - if (array_key_exists($sObjKey, $aResults[$sRootClass])) - { - continue; // already visited, skip - } - } - - $aResults[$sRootClass][$sObjKey] = $oObj; - if ($iDepth > 0) - { - $oObj->GetRelatedObjects($sRelCode, $iDepth, $aResults); - } - } - while ($oObj = $oObjSet->Fetch()); - } - } - return $aResults; - } - /** * Compute the "RelatedObjects" (forward or "down" direction) for the object * for the specified relation diff --git a/core/dbobjectset.class.php b/core/dbobjectset.class.php index 076dbb954..fa2dea8de 100644 --- a/core/dbobjectset.class.php +++ b/core/dbobjectset.class.php @@ -1312,34 +1312,6 @@ class DBObjectSet implements iDBObjectSetIterator return $oNewSet; } - /** - * Will be deprecated soon - use MetaModel::GetRelatedObjectsDown/Up instead to take redundancy into account - * - * @throws \Exception - */ - public function GetRelatedObjects($sRelCode, $iMaxDepth = 99) - { - $aRelatedObjs = array(); - - $aVisited = array(); // optimization for consecutive calls of MetaModel::GetRelatedObjects - $this->Seek(0); - while ($oObject = $this->Fetch()) - { - $aMore = $oObject->GetRelatedObjects($sRelCode, $iMaxDepth, $aVisited); - foreach ($aMore as $sClass => $aRelated) - { - foreach ($aRelated as $iObj => $oObj) - { - if (!isset($aRelatedObjs[$sClass][$iObj])) - { - $aRelatedObjs[$sClass][$iObj] = $oObj; - } - } - } - } - return $aRelatedObjs; - } - /** * Compute the "RelatedObjects" (forward or "down" direction) for the set * for the specified relation