/** * Compute the "RelatedObjects" for a whole set of DBObjects * * @param string $sRelCode The code of the relation to use for the computation * @param array $asourceObjects The objects to start with * @param int $iMaxDepth * @param boolean $bEnableReduncancy * @param array $aUnreachable Array of objects to be considered as 'unreachable' * * @return RelationGraph The graph of all the related objects */ public static function GetRelatedObjectsDown($sRelCode, $aSourceObjects, $iMaxDepth = 99, $bEnableRedundancy = true, $aUnreachable = array(), $aContexts = array()) { $oGraph = new RelationGraph(); foreach ($aSourceObjects as $oObject) { $oGraph->AddSourceObject($oObject); } foreach ($aContexts as $key => $sOQL) { $oGraph->AddContextQuery($key, $sOQL); } $oGraph->ComputeRelatedObjectsDown($sRelCode, $iMaxDepth, $bEnableRedundancy, $aUnreachable); return $oGraph; }
/** * Compute the "RelatedObjects" (forward or "down" direction) for the set * for the specified relation * * @param string $sRelCode The code of the relation to use for the computation * @param int $iMaxDepth Maximum recursion depth * @param boolean $bEnableReduncancy Whether or not to take into account the redundancy * * @return RelationGraph The graph of all the related objects */ public function GetRelatedObjectsDown($sRelCode, $iMaxDepth = 99, $bEnableRedundancy = true) { $oGraph = new RelationGraph(); $this->Rewind(); while ($oObj = $this->Fetch()) { $oGraph->AddSourceObject($oObj); } $oGraph->ComputeRelatedObjectsDown($sRelCode, $iMaxDepth, $bEnableRedundancy); return $oGraph; }
/** * Compute the "RelatedObjects" (reverse or "up" direction) for the object * for the specified relation * * @param string $sRelCode The code of the relation to use for the computation * @param int $iMaxDepth Maximum recursion depth * @param boolean $bEnableReduncancy Whether or not to take into account the redundancy * * @return RelationGraph The graph of all the related objects */ public function GetRelatedObjectsUp($sRelCode, $iMaxDepth = 99, $bEnableRedundancy = true) { $oGraph = new RelationGraph(); $oGraph->AddSourceObject($this); $oGraph->ComputeRelatedObjectsUp($sRelCode, $iMaxDepth, $bEnableRedundancy); return $oGraph; }