当前位置: 首页>>代码示例>>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;未经允许,请勿转载。