當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DBObjectSearch::AddConditionAdvanced方法代碼示例

本文整理匯總了PHP中DBObjectSearch::AddConditionAdvanced方法的典型用法代碼示例。如果您正苦於以下問題:PHP DBObjectSearch::AddConditionAdvanced方法的具體用法?PHP DBObjectSearch::AddConditionAdvanced怎麽用?PHP DBObjectSearch::AddConditionAdvanced使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DBObjectSearch的用法示例。


在下文中一共展示了DBObjectSearch::AddConditionAdvanced方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: PostedParamsToFilter

 public function PostedParamsToFilter($sClass, $aAttList, $sPrefix)
 {
     $oFilter = new DBObjectSearch($sClass);
     $iCountParams = 0;
     foreach ($aAttList as $sAttSpec) {
         $sFieldName = str_replace('->', PARAM_ARROW_SEP, $sAttSpec);
         $value = utils::ReadPostedParam($sPrefix . $sFieldName, null, 'raw_data');
         if (!is_null($value) && (is_array($value) ? count($value) > 0 : strlen($value) > 0)) {
             $oFilter->AddConditionAdvanced($sAttSpec, $value);
             $iCountParams++;
         }
     }
     if ($iCountParams == 0) {
         return null;
     } else {
         return $oFilter;
     }
 }
開發者ID:leandroborgeseng,項目名稱:bhtm,代碼行數:18,代碼來源:portalwebpage.class.inc.php

示例2: AddConditionAdvanced

 /**
  * Specify a condition on external keys or link sets
  * @param sAttSpec Can be either an attribute code or extkey->[sAttSpec] or linkset->[sAttSpec] and so on, recursively
  *                 Example: infra_list->ci_id->location_id->country	 
  * @param value The value to match (can be an array => IN(val1, val2...)
  * @return void
  */
 public function AddConditionAdvanced($sAttSpec, $value)
 {
     $sClass = $this->GetClass();
     $iPos = strpos($sAttSpec, '->');
     if ($iPos !== false) {
         $sAttCode = substr($sAttSpec, 0, $iPos);
         $sSubSpec = substr($sAttSpec, $iPos + 2);
         if (!MetaModel::IsValidAttCode($sClass, $sAttCode)) {
             throw new Exception("Invalid attribute code '{$sClass}/{$sAttCode}' in condition specification '{$sAttSpec}'");
         }
         $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
         if ($oAttDef->IsLinkSet()) {
             $sTargetClass = $oAttDef->GetLinkedClass();
             $sExtKeyToMe = $oAttDef->GetExtKeyToMe();
             $oNewFilter = new DBObjectSearch($sTargetClass);
             $oNewFilter->AddConditionAdvanced($sSubSpec, $value);
             $this->AddCondition_ReferencedBy($oNewFilter, $sExtKeyToMe);
         } elseif ($oAttDef->IsExternalKey(EXTKEY_ABSOLUTE)) {
             $sTargetClass = $oAttDef->GetTargetClass(EXTKEY_ABSOLUTE);
             $oNewFilter = new DBObjectSearch($sTargetClass);
             $oNewFilter->AddConditionAdvanced($sSubSpec, $value);
             $this->AddCondition_PointingTo($oNewFilter, $sAttCode);
         } else {
             throw new Exception("Attribute specification '{$sAttSpec}', '{$sAttCode}' should be either a link set or an external key");
         }
     } else {
         // $sAttSpec is an attribute code
         //
         if (is_array($value)) {
             $oField = new FieldExpression($sAttSpec, $this->GetClass());
             $oListExpr = ListExpression::FromScalars($value);
             $oInValues = new BinaryExpression($oField, 'IN', $oListExpr);
             $this->AddConditionExpression($oInValues);
         } else {
             $this->AddCondition($sAttSpec, $value);
         }
     }
 }
開發者ID:besmirzanaj,項目名稱:itop-code,代碼行數:45,代碼來源:dbobjectsearch.class.php


注:本文中的DBObjectSearch::AddConditionAdvanced方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。