当前位置: 首页>>代码示例>>PHP>>正文


PHP DBObject::GetKey方法代码示例

本文整理汇总了PHP中DBObject::GetKey方法的典型用法代码示例。如果您正苦于以下问题:PHP DBObject::GetKey方法的具体用法?PHP DBObject::GetKey怎么用?PHP DBObject::GetKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBObject的用法示例。


在下文中一共展示了DBObject::GetKey方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: MakeResultValue

 /**
  * Helper to make an output value for a given attribute
  * 	 
  * @param DBObject $oObject The object being reported
  * @param string $sAttCode The attribute code (must be valid)
  * @param boolean $bExtendedOutput Output all of the link set attributes ?
  * @return string A scalar representation of the value
  */
 protected function MakeResultValue(DBObject $oObject, $sAttCode, $bExtendedOutput = false)
 {
     if ($sAttCode == 'id') {
         $value = $oObject->GetKey();
     } else {
         $sClass = get_class($oObject);
         $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
         if ($oAttDef instanceof AttributeLinkedSet) {
             // Iterate on the set and build an array of array of attcode=>value
             $oSet = $oObject->Get($sAttCode);
             $value = array();
             while ($oLnk = $oSet->Fetch()) {
                 $sLnkRefClass = $bExtendedOutput ? get_class($oLnk) : $oAttDef->GetLinkedClass();
                 $aLnkValues = array();
                 foreach (MetaModel::ListAttributeDefs($sLnkRefClass) as $sLnkAttCode => $oLnkAttDef) {
                     // Skip attributes pointing to the current object (redundant data)
                     if ($sLnkAttCode == $oAttDef->GetExtKeyToMe()) {
                         continue;
                     }
                     // Skip any attribute of the link that points to the current object
                     $oLnkAttDef = MetaModel::GetAttributeDef($sLnkRefClass, $sLnkAttCode);
                     if (method_exists($oLnkAttDef, 'GetKeyAttCode')) {
                         if ($oLnkAttDef->GetKeyAttCode() == $oAttDef->GetExtKeyToMe()) {
                             continue;
                         }
                     }
                     $aLnkValues[$sLnkAttCode] = $this->MakeResultValue($oLnk, $sLnkAttCode, $bExtendedOutput);
                 }
                 $value[] = $aLnkValues;
             }
         } else {
             $value = $oAttDef->GetForJSON($oObject->Get($sAttCode));
         }
     }
     return $value;
 }
开发者ID:henryavila,项目名称:itop,代码行数:44,代码来源:restservices.class.inc.php

示例2: GetSampleKey

 protected function GetSampleKey(DBObject $oObj)
 {
     if ($oObj == null) {
         return '';
     }
     return $oObj->GetKey();
 }
开发者ID:henryavila,项目名称:itop,代码行数:7,代码来源:tabularbulkexport.class.inc.php

示例3: AddObject

 public function AddObject(DBObject $oObj)
 {
     $this->aObjects[$oObj->GetKey()] = $oObj;
 }
开发者ID:henryavila,项目名称:itop,代码行数:4,代码来源:displayablegraph.class.inc.php

示例4: SearchObjectsToAdd

 /**
  * Search for objects to be linked to the current object (i.e "remote" objects)
  * @param WebPage $oP The page used for the output (usually an AjaxWebPage)
  * @param string $sRemoteClass Name of the "remote" class to perform the search on, must be a derived class of $this->sLinkedClass
  * @param array $aAlreadyLinked Array of indentifiers of objects which are already linke to the current object (or about to be linked)
  * @param DBObject $oCurrentObj The object currently being edited... if known...
  */
 public function SearchObjectsToAdd(WebPage $oP, $sRemoteClass = '', $aAlreadyLinked = array(), $oCurrentObj = null)
 {
     if ($sRemoteClass == '') {
         $sRemoteClass = $this->sLinkedClass;
     }
     $oLinksetDef = MetaModel::GetAttributeDef($this->sClass, $this->sAttCode);
     $valuesDef = $oLinksetDef->GetValuesDef();
     if ($valuesDef === null) {
         $oFilter = new DBObjectSearch($this->sLinkedClass);
     } else {
         if (!$valuesDef instanceof ValueSetObjects) {
             throw new Exception('Error: only ValueSetObjects are supported for "allowed_values" in AttributeLinkedSet (' . $this->sClass . '/' . $this->sAttCode . ').');
         }
         $oFilter = DBObjectSearch::FromOQL($valuesDef->GetFilterExpression());
     }
     if ($oCurrentObj != null && MetaModel::IsSameFamilyBranch($sRemoteClass, $this->sClass)) {
         // Prevent linking to self if the linked object is of the same family
         // and laready present in the database
         if (!$oCurrentObj->IsNew()) {
             $oFilter->AddCondition('id', $oCurrentObj->GetKey(), '!=');
         }
     }
     if (count($aAlreadyLinked) > 0) {
         $oFilter->AddCondition('id', $aAlreadyLinked, 'NOTIN');
     }
     if ($oCurrentObj != null) {
         $aArgs = array_merge($oCurrentObj->ToArgs('this'), $oFilter->GetInternalParams());
         $oFilter->SetInternalParams($aArgs);
     }
     $oBlock = new DisplayBlock($oFilter, 'list', false);
     $oBlock->Display($oP, "ResultsToAdd_{$this->sInputid}", array('menu' => false, 'cssCount' => '#count_' . $this->sInputid, 'selection_mode' => true, 'table_id' => 'add_' . $this->sInputid));
     // Don't display the 'Actions' menu on the results
 }
开发者ID:kira8565,项目名称:ITOP203-ZHCN,代码行数:40,代码来源:ui.linksdirectwidget.class.inc.php


注:本文中的DBObject::GetKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。