本文整理汇总了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;
}
}
示例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'));
}
示例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();
}
}