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


PHP RedBeanModel::getClassId方法代碼示例

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


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

示例1: resolveByWorkflowIdAndModel

 /**
  * @param SavedWorkflow $savedWorkflow
  * @param RedBeanModel $model
  * @return ByTimeWorkflowInQueue
  * @throws NotSupportedException
  */
 public static function resolveByWorkflowIdAndModel(SavedWorkflow $savedWorkflow, RedBeanModel $model)
 {
     $searchAttributeData = array();
     $searchAttributeData['clauses'] = array(1 => array('attributeName' => 'modelItem', 'operatorType' => 'equals', 'value' => $model->getClassId('Item')), 2 => array('attributeName' => 'savedWorkflow', 'operatorType' => 'equals', 'value' => $savedWorkflow->id), 3 => array('attributeName' => 'modelClassName', 'operatorType' => 'equals', 'value' => get_class($model)));
     $searchAttributeData['structure'] = '1 and 2 and 3';
     $joinTablesAdapter = new RedBeanModelJoinTablesQueryAdapter('ByTimeWorkflowInQueue');
     $where = RedBeanModelDataProvider::makeWhere('ByTimeWorkflowInQueue', $searchAttributeData, $joinTablesAdapter);
     $models = self::getSubset($joinTablesAdapter, null, null, $where, null);
     if (count($models) > 1) {
         throw new NotSupportedException();
     } elseif (count($models) == 1) {
         return $models[0];
     } else {
         $byTimeWorkflowInQueue = new ByTimeWorkflowInQueue();
         $byTimeWorkflowInQueue->modelClassName = get_class($model);
         $byTimeWorkflowInQueue->modelItem = $model;
         $byTimeWorkflowInQueue->savedWorkflow = $savedWorkflow;
         return $byTimeWorkflowInQueue;
     }
 }
開發者ID:youprofit,項目名稱:Zurmo,代碼行數:26,代碼來源:ByTimeWorkflowInQueue.php

示例2: resolveDerivedModels

 /**
  * @param RedBeanModel $model
  * @param string $relation
  * @return Array of models
  */
 public static function resolveDerivedModels(RedBeanModel $model, $relation)
 {
     assert('is_string($relation)');
     $modelClassName = $model->getDerivedRelationModelClassName($relation);
     $inferredRelationName = $model->getDerivedRelationViaCastedUpModelOpposingRelationName($relation);
     return WorkflowUtil::getModelsFilteredByInferredModel($modelClassName, $inferredRelationName, (int) $model->getClassId('Item'));
 }
開發者ID:RamaKavanan,項目名稱:InitialVersion,代碼行數:12,代碼來源:WorkflowUtil.php

示例3: processCopyEmailActivity

 /**
  * Process copy email activity.
  *
  * @param RedBeanModel $primaryModel
  * @param RedBeanModel $selectedModel
  */
 public static function processCopyEmailActivity($primaryModel, $selectedModel)
 {
     $searchAttributesData = LatestActivitiesUtil::getSearchAttributesDataByModelClassNamesAndRelatedItemIds(array('EmailMessage'), array($selectedModel->getClassId('Item')), LatestActivitiesConfigurationForm::OWNED_BY_FILTER_ALL);
     $joinTablesAdapter = new RedBeanModelJoinTablesQueryAdapter('EmailMessage');
     $where = RedBeanModelDataProvider::makeWhere('EmailMessage', $searchAttributesData[0]['EmailMessage'], $joinTablesAdapter);
     $models = EmailMessage::getSubset($joinTablesAdapter, null, null, $where, null);
     if (isset($searchAttributesData[1]['EmailMessage'])) {
         $where = RedBeanModelDataProvider::makeWhere('EmailMessage', $searchAttributesData[1]['EmailMessage'], $joinTablesAdapter);
         $models = array_merge($models, EmailMessage::getSubset($joinTablesAdapter, null, null, $where, null));
     }
     foreach ($models as $model) {
         //Resolve sender
         if ($model->sender->personsOrAccounts->contains($selectedModel)) {
             $model->sender->personsOrAccounts->remove($selectedModel);
             if (!$model->sender->personsOrAccounts->contains($primaryModel)) {
                 $model->sender->personsOrAccounts->add($primaryModel);
             }
         }
         //recipients
         foreach ($model->recipients as $key => $unused) {
             if ($model->recipients[$key]->personsOrAccounts->contains($selectedModel)) {
                 $model->recipients[$key]->personsOrAccounts->remove($selectedModel);
                 if (!$model->recipients[$key]->personsOrAccounts->contains($primaryModel)) {
                     $model->recipients[$key]->personsOrAccounts->add($primaryModel);
                 }
             }
         }
         $model->save();
     }
 }
開發者ID:RamaKavanan,項目名稱:InitialVersion,代碼行數:36,代碼來源:ListViewMergeUtil.php


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