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


PHP RedBeanModel::isAttribute方法代碼示例

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


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

示例1: relationIsReportedAsAttribute

 /**
  * @param string $relation
  * @return bool
  */
 public function relationIsReportedAsAttribute($relation)
 {
     assert('is_string($relation)');
     if ($this->model->isAttribute($relation) && $this->isReportedOnAsARelation($relation)) {
         return false;
     }
     if ($this->model->isAttribute($relation) && !$this->model->isRelation($relation)) {
         return false;
     }
     if ($this->isDerivedAttribute($relation)) {
         return false;
     }
     return $this->rules->relationIsReportedAsAttribute($this->model, $relation);
 }
開發者ID:sandeep1027,項目名稱:zurmo_,代碼行數:18,代碼來源:ModelRelationsAndAttributesToReportAdapter.php

示例2: relationLinksToPrecedingRelation

 /**
  * @param string $relation
  * @param null|RedBeanModel $precedingModel
  * @param null|string $precedingRelation
  * @return bool
  */
 protected function relationLinksToPrecedingRelation($relation, RedBeanModel $precedingModel = null, $precedingRelation = null)
 {
     assert('is_string($relation)');
     if ($precedingModel == null || $precedingRelation == null) {
         return false;
     }
     //Check if the relation is a derived relation in which case return false because it is handled by
     //@see self::inferredRelationLinksToPrecedingRelation
     if (!$precedingModel->isAttribute($precedingRelation)) {
         return false;
     }
     if (get_class($precedingModel) != $this->model->getRelationmodelClassName($relation)) {
         return false;
     }
     if ($precedingModel->getRelationLinkType($precedingRelation) == RedBeanModel::LINK_TYPE_ASSUMPTIVE && $this->model->getRelationLinkType($relation) == RedBeanModel::LINK_TYPE_ASSUMPTIVE) {
         return true;
     }
     //Check for LINK_TYPE_SPECIFIC
     if ($precedingModel->getRelationLinkType($precedingRelation) == RedBeanModel::LINK_TYPE_SPECIFIC && $this->model->getRelationLinkType($relation) == RedBeanModel::LINK_TYPE_SPECIFIC && $precedingModel->getRelationLinkName($precedingRelation) == $this->model->getRelationLinkName($relation)) {
         return true;
     }
     return false;
 }
開發者ID:sandeep1027,項目名稱:zurmo_,代碼行數:29,代碼來源:ModelRelationsAndAttributesToWorkflowAdapter.php

示例3: manageModelRelations

 /**
  * @param RedBeanModel $model
  * @param array $modelRelations
  * @return bool
  * @throws ApiException
  */
 protected function manageModelRelations($model, $modelRelations)
 {
     try {
         if (isset($modelRelations) && !empty($modelRelations)) {
             foreach ($modelRelations as $modelRelation => $relations) {
                 if ($model->isAttribute($modelRelation) && ($model->getRelationType($modelRelation) == RedBeanModel::HAS_MANY || $model->getRelationType($modelRelation) == RedBeanModel::MANY_MANY)) {
                     foreach ($relations as $relation) {
                         $relatedModelClassName = $relation['modelClassName'];
                         try {
                             $relatedModel = $relatedModelClassName::getById(intval($relation['modelId']));
                         } catch (Exception $e) {
                             $message = Zurmo::t('ZurmoModule', 'The related model ID specified was invalid.');
                             throw new NotFoundException($message);
                         }
                         if ($relation['action'] == 'add') {
                             $model->{$modelRelation}->add($relatedModel);
                         } elseif ($relation['action'] == 'remove') {
                             $model->{$modelRelation}->remove($relatedModel);
                         } else {
                             $message = Zurmo::t('ZurmoModule', 'Unsupported action.');
                             throw new NotSupportedException($message);
                         }
                     }
                 } else {
                     $message = Zurmo::t('ZurmoModule', 'You can add relations only for HAS_MANY and MANY_MANY relations.');
                     throw new NotSupportedException($message);
                 }
             }
         }
     } catch (Exception $e) {
         $message = $e->getMessage();
         throw new ApiException($message);
     }
     return true;
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:41,代碼來源:ZurmoModuleApiController.php

示例4: resolveModelAttributeValueForPenultimateRelation

 /**
  * @param RedBeanModel $model
  * @param string $attribute
  * @param DisplayAttributeForReportForm $displayAttribute
  * @return mixedg $value
  * @throws NotSupportedException
  */
 protected function resolveModelAttributeValueForPenultimateRelation(RedBeanModel $model, $attribute, DisplayAttributeForReportForm $displayAttribute)
 {
     if ($model->isAttribute($attribute)) {
         return $model->{$attribute};
     }
     $penultimateRelation = $displayAttribute->getPenultimateRelation();
     if (!$model->isAttribute($penultimateRelation)) {
         throw new NotSupportedException();
     }
     return $model->{$penultimateRelation}->{$attribute};
 }
開發者ID:sandeep1027,項目名稱:zurmo_,代碼行數:18,代碼來源:ReportResultsRowData.php

示例5: resolveModelAttributeValueForPenultimateRelation

 /**
  * The check for OwnedModel below, is because it is possible that something like Address 'state' would be coming
  * into this method for retrieval. but depending how things are called, it might need to use the penultimate
  * relation instead of looking for the attribute on the $model.
  * @param RedBeanModel $model
  * @param string $attribute
  * @param DisplayAttributeForReportForm $displayAttribute
  * @return mixedg $value
  * @throws NotSupportedException
  */
 protected function resolveModelAttributeValueForPenultimateRelation(RedBeanModel $model, $attribute, DisplayAttributeForReportForm $displayAttribute)
 {
     if ($model->isAttribute($attribute) && !is_subclass_of($displayAttribute->getResolvedAttributeModelClassName(), 'OwnedModel')) {
         return $model->{$attribute};
     }
     $penultimateRelation = $displayAttribute->getPenultimateRelation();
     if (!$model->isAttribute($penultimateRelation)) {
         //Fallback. For some reason this could in fact reference the original $model attribute, but because it is
         //not owned, it gets confused. todo: need to investigate this further because this is not proper.
         if ($model->isAttribute($attribute)) {
             return $model->{$attribute};
         }
         throw new NotSupportedException();
     }
     return $model->{$penultimateRelation}->{$attribute};
 }
開發者ID:youprofit,項目名稱:Zurmo,代碼行數:26,代碼來源:ReportResultsRowData.php


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