当前位置: 首页>>代码示例>>PHP>>正文


PHP RedBeanModel::getRelationModelClassName方法代码示例

本文整理汇总了PHP中RedBeanModel::getRelationModelClassName方法的典型用法代码示例。如果您正苦于以下问题:PHP RedBeanModel::getRelationModelClassName方法的具体用法?PHP RedBeanModel::getRelationModelClassName怎么用?PHP RedBeanModel::getRelationModelClassName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RedBeanModel的用法示例。


在下文中一共展示了RedBeanModel::getRelationModelClassName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: resolveDynamicallyDerivedAttributesForActionsOrTimeTriggerData

 /**
  * @param boolean $includeRequired
  * @param boolean $includeNonRequired
  * @param $includeReadOnly
  * @return array
  */
 protected function resolveDynamicallyDerivedAttributesForActionsOrTimeTriggerData($includeRequired = false, $includeNonRequired = false, $includeReadOnly = false)
 {
     assert('is_bool($includeRequired)');
     assert('is_bool($includeNonRequired)');
     assert('is_bool($includeReadOnly)');
     $attributes = array();
     foreach ($this->model->getAttributes() as $attribute => $notUsed) {
         if (!$this->model instanceof User && $this->model->isRelation($attribute) && (!$this->model->isAttributeReadOnly($attribute) || $includeReadOnly) && $this->model->getRelationModelClassName($attribute) == 'User') {
             $attributeIsRequired = $this->model->isAttributeRequired($attribute);
             if ($includeNonRequired && !$attributeIsRequired || $includeRequired && $attributeIsRequired) {
                 $attributes[$attribute . FormModelUtil::DELIMITER . self::DYNAMIC_ATTRIBUTE_USER] = array('label' => $this->model->getAttributeLabel($attribute));
             }
         }
         if ($this->model->isRelation($attribute) && $this->model->isOwnedRelation($attribute) && $this->isRelationASingularRelation($attribute) && ($this->model->getRelationModelClassName($attribute) == 'Address' || $this->model->getRelationModelClassName($attribute) == 'Email')) {
             $relatedModel = $this->model->{$attribute};
             //Assumes only Email or Address are possible owned models here
             $zurmoRules = WorkflowRules::makeByModuleClassName('ZurmoModule');
             foreach ($relatedModel->getAttributes() as $relatedAttribute => $notUsed) {
                 if (!$relatedModel->isAttributeReadOnly($relatedAttribute) && !$relatedModel->isRelation($relatedAttribute) && $zurmoRules->attributeCanBeTriggered($relatedModel, $relatedAttribute)) {
                     $relatedAttributeIsRequired = $relatedModel->isAttributeRequired($relatedAttribute);
                     if ($includeNonRequired && !$relatedAttributeIsRequired || $includeRequired && $relatedAttributeIsRequired) {
                         $attributes[$attribute . FormModelUtil::RELATION_DELIMITER . $relatedAttribute] = array('label' => $this->model->getAttributeLabel($attribute) . ' ' . ComponentForWorkflowForm::DISPLAY_LABEL_RELATION_DIVIDER . ' ' . $relatedModel->getAttributeLabel($relatedAttribute));
                     }
                 }
             }
         }
     }
     return $attributes;
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:35,代码来源:ModelRelationsAndAttributesToWorkflowAdapter.php

示例2: relationIsUsedAsAttribute

 /**
  * Some relations such as a CustomField are shown as non-related nodes in the workflow wizard. For a custom field
  * this method would return true for example.  Whereas account -> opportunities would return false.
  * @param RedBeanModel $model
  * @param $relation
  * @return bool
  */
 public function relationIsUsedAsAttribute(RedBeanModel $model, $relation)
 {
     assert('is_string($relation)');
     $modelClassName = $model->getAttributeModelClassName($relation);
     $metadata = static::getMetadata();
     if (isset($metadata[$modelClassName]) && isset($metadata[$modelClassName]['relationIsUsedAsAttributes']) && in_array($relation, $metadata[$modelClassName]['relationIsUsedAsAttributes'])) {
         return true;
     }
     if (in_array($model->getRelationModelClassName($relation), array('OwnedCustomField', 'CustomField', 'OwnedMultipleValuesCustomField', 'MultipleValuesCustomField', 'CurrencyValue'))) {
         return true;
     }
     return false;
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:20,代码来源:WorkflowRules.php

示例3: getDynamicallyDerivedAttributesData

 /**
  * @return array
  */
 protected function getDynamicallyDerivedAttributesData()
 {
     if (isset(self::$dynamicallyDerivedAttributesData[get_class($this->model)])) {
         return self::$dynamicallyDerivedAttributesData[get_class($this->model)];
     }
     $attributes = array();
     foreach ($this->model->getAttributes() as $attribute => $notUsed) {
         if (!$this->model instanceof User && $this->model->isRelation($attribute) && $this->model->getRelationModelClassName($attribute) == 'User') {
             $attributes[$attribute . FormModelUtil::DELIMITER . self::DYNAMIC_ATTRIBUTE_USER] = array('label' => $this->model->getAttributeLabel($attribute));
         }
     }
     self::$dynamicallyDerivedAttributesData[get_class($this->model)] = $attributes;
     return self::$dynamicallyDerivedAttributesData[get_class($this->model)];
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:17,代码来源:ModelRelationsAndAttributesToReportAdapter.php

示例4: makeMessagesByModel

 /**
  * Make an array of message strings by RedBeanModel errors
  * @param array $errors RedBeanModel errors
  */
 public static function makeMessagesByModel(RedBeanModel $model)
 {
     $messages = array();
     foreach ($model->getErrors() as $attributeName => $errors) {
         foreach ($errors as $relationAttributeName => $errorOrRelatedError) {
             if (is_array($errorOrRelatedError)) {
                 $relationModelClassName = $model->getRelationModelClassName($attributeName);
                 foreach ($errorOrRelatedError as $relatedError) {
                     if ($relatedError != '') {
                         $messages[] = LabelUtil::makeModelAndAttributeNameCombinationLabel(get_class($model), $attributeName) . ' - ' . $relatedError;
                     }
                 }
             } elseif ($errorOrRelatedError != '') {
                 $messages[] = LabelUtil::makeModelAndAttributeNameCombinationLabel(get_class($model), $attributeName) . ' - ' . $errorOrRelatedError;
             }
         }
     }
     return $messages;
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:23,代码来源:RedBeanModelErrorsToMessagesUtil.php

示例5: getGroupByRelatedAttributeForRelationReportedAsAttribute

 /**
  * @param RedBeanModel $model
  * @param string $relation
  * @return null|string
  * @throws NotSupportedException if the relation is not really reported as an attribute
  */
 public function getGroupByRelatedAttributeForRelationReportedAsAttribute(RedBeanModel $model, $relation)
 {
     assert('is_string($relation)');
     $modelClassName = $model->getAttributeModelClassName($relation);
     $metadata = static::getMetadata();
     if (isset($metadata[$modelClassName]) && isset($metadata[$modelClassName]['relationsReportedAsAttributes']) && in_array($relation, $metadata[$modelClassName]['relationsReportedAsAttributes'])) {
         if (isset($metadata[$modelClassName]['relationsReportedAsAttributesGroupByAttributes'][$relation])) {
             return $metadata[$modelClassName]['relationsReportedAsAttributesGroupByAttributes'][$relation];
         } else {
             return null;
         }
     }
     if (in_array($model->getRelationModelClassName($relation), array('OwnedCustomField', 'CustomField', 'OwnedMultipleValuesCustomField', 'MultipleValuesCustomField', 'CurrencyValue'))) {
         return 'value';
     }
     throw new NotSupportedException();
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:23,代码来源:ReportRules.php


注:本文中的RedBeanModel::getRelationModelClassName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。