Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

N°7348 - Enable to param maximum depth of impact analysis in function Ticket::UpdateImpactedItems #633

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 11 additions & 3 deletions datamodels/2.x/itop-tickets/main.itop-tickets.php
Expand Up @@ -133,7 +133,15 @@ public function ComputeMetric($oObject)
class _Ticket extends cmdbAbstractObject
{

public function UpdateImpactedItems()
/**
* @param int $iMaxDepth maximum depth of impact analysis
*
* @return void
* @throws \ArchivedObjectException
* @throws \CoreException
* @throws \CoreUnexpectedValue
*/
public function UpdateImpactedItems(int $iMaxDepth = 10)
{
require_once(APPROOT.'core/displayablegraph.class.inc.php');
/** @var ormLinkSet $oContactsSet */
Expand Down Expand Up @@ -188,7 +196,7 @@ public function UpdateImpactedItems()
}
// Merge the directly impacted items with the "new" ones added by the "context" queries
$aGraphObjects = array();
$oRawGraph = MetaModel::GetRelatedObjectsDown('impacts', $aSources, 10, true /* bEnableRedundancy */, $aExcluded);
$oRawGraph = MetaModel::GetRelatedObjectsDown('impacts', $aSources, $iMaxDepth, true /* bEnableRedundancy */, $aExcluded);
$oIterator = new RelationTypeIterator($oRawGraph, 'Node');
foreach ($oIterator as $oNode)
{
Expand All @@ -200,7 +208,7 @@ public function UpdateImpactedItems()
}
if (count($aDefaultContexts) > 0)
{
$oAnnotatedGraph = MetaModel::GetRelatedObjectsDown('impacts', $aSources, 10, true /* bEnableRedundancy */, $aExcluded, $aDefaultContexts);
$oAnnotatedGraph = MetaModel::GetRelatedObjectsDown('impacts', $aSources, $iMaxDepth, true /* bEnableRedundancy */, $aExcluded, $aDefaultContexts);
$oIterator = new RelationTypeIterator($oAnnotatedGraph, 'Node');
foreach ($oIterator as $oNode)
{
Expand Down