本文整理汇总了PHP中DBObjectSet::FromLinkSet方法的典型用法代码示例。如果您正苦于以下问题:PHP DBObjectSet::FromLinkSet方法的具体用法?PHP DBObjectSet::FromLinkSet怎么用?PHP DBObjectSet::FromLinkSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBObjectSet
的用法示例。
在下文中一共展示了DBObjectSet::FromLinkSet方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ComputeImpactedItems
public function ComputeImpactedItems()
{
$oToNotify = $this->Get('contacts_list');
$oToImpact = $this->Get('functionalcis_list');
$oImpactedInfras = DBObjectSet::FromLinkSet($this, 'functionalcis_list', 'functionalci_id');
$aComputed = $oImpactedInfras->GetRelatedObjects('impacts', 10);
if (isset($aComputed['FunctionalCI']) && is_array($aComputed['FunctionalCI'])) {
foreach ($aComputed['FunctionalCI'] as $iKey => $oObject) {
$oNewLink = new lnkFunctionalCIToTicket();
$oNewLink->Set('functionalci_id', $iKey);
$oNewLink->Set('impact', 'potentially impacted (automatically computed)');
$oToImpact->AddObject($oNewLink);
}
}
if (isset($aComputed['Contact']) && is_array($aComputed['Contact'])) {
foreach ($aComputed['Contact'] as $iKey => $oObject) {
$oNewLink = new lnkContactToTicket();
$oNewLink->Set('contact_id', $iKey);
$oNewLink->Set('role', 'contact automatically computed');
$oToNotify->AddObject($oNewLink);
}
}
parent::OnInsert();
}
示例2: OnInsert
protected function OnInsert()
{
$oToNotify = $this->Get('contacts_list');
$oToImpact = $this->Get('functionalcis_list');
$oImpactedInfras = DBObjectSet::FromLinkSet($this, 'functionalcis_list', 'functionalci_id');
$aComputed = $oImpactedInfras->GetRelatedObjects('impacts', 10);
if (isset($aComputed['FunctionalCI']) && is_array($aComputed['FunctionalCI'])) {
foreach ($aComputed['FunctionalCI'] as $iKey => $oObject) {
$oNewLink = new lnkFunctionalCIToTicket();
$oNewLink->Set('functionalci_id', $iKey);
$oToImpact->AddObject($oNewLink);
}
}
if (isset($aComputed['Contact']) && is_array($aComputed['Contact'])) {
foreach ($aComputed['Contact'] as $iKey => $oObject) {
$oNewLink = new lnkContactToTicket();
$oNewLink->Set('contact_id', $iKey);
$oNewLink->Set('role', 'contact automatically computed');
$oToNotify->AddObject($oNewLink);
}
}
$this->Set('creation_date', time());
$this->Set('last_update', time());
}
示例3: LoadValues
protected function LoadValues($aArgs)
{
$this->m_aValues = array();
if (!array_key_exists('this', $aArgs)) {
throw new CoreException("Missing 'this' in arguments", array('args' => $aArgs));
}
$oTarget = $aArgs['this->object()'];
// Nodes from which we will start the search for neighbourhood
$oNodes = DBObjectSet::FromLinkSet($oTarget, $this->m_sLinkSetAttCode, $this->m_sExtKeyToRemote);
// Neighbours, whatever their class
$aRelated = $oNodes->GetRelatedObjects($this->m_sRelationCode, $this->m_iMaxDepth);
$sRootClass = MetaModel::GetRootClass($this->m_sTargetClass);
if (array_key_exists($sRootClass, $aRelated)) {
$aLinksToCreate = array();
foreach ($aRelated[$sRootClass] as $iKey => $oObject) {
if (MetaModel::IsParentClass($this->m_sTargetClass, get_class($oObject))) {
$oNewLink = MetaModel::NewObject($this->m_sTargetLinkClass);
$oNewLink->Set($this->m_sTargetExtKey, $iKey);
//$oNewLink->Set('role', 'concerned by an impacted CI');
$aLinksToCreate[] = $oNewLink;
}
}
// #@# or AddObjectArray($aObjects) ?
$oSetToCreate = DBObjectSet::FromArray($this->m_sTargetLinkClass, $aLinksToCreate);
$this->m_aValues[$oObject->GetKey()] = $oObject->GetName();
}
return true;
}