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