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


PHP CActiveRecord::relations方法代码示例

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


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

示例1: relations

 /**
  * Returns the relations used for the model
  *
  * @return array
  * @see YdDressing::modelMap
  */
 public function relations()
 {
     if (!empty(Yii::app()->dressing->modelMap[get_class($this)]['relations'])) {
         return Yii::app()->dressing->modelMap[get_class($this)]['relations'];
     }
     return parent::relations();
 }
开发者ID:cornernote,项目名称:yii-dressing,代码行数:13,代码来源:YdActiveRecord.php

示例2: Model2ArrayRec

 /**
  * @param CActiveRecord $model
  * */
 private static function Model2ArrayRec($model)
 {
     $data = $model->attributes;
     //Levantando relacionamentos
     $rels = $model->relations();
     foreach ($rels as $relation => $params) {
         //Irá gerar um vetor com todos os relacionamentos
         if ($model->hasRelated($relation)) {
             $data[$relation] = self::relations2Array($model, $relation);
         }
     }
     return $data;
 }
开发者ID:bruno-melo,项目名称:components,代码行数:16,代码来源:Webservice.php

示例3: processModel

 /**
  * Recursive function that deletes all children models to the $model.
  * 
  * @param CActiveRecord $model the model to process.
  * @param boolean $delete whether to delete the $model (the top model's deletion is handled by beforeDelete).
  */
 protected function processModel($model, $delete = true)
 {
     foreach ($model->relations() as $relationName => $relation) {
         $type = $relation[0];
         $className = $relation[1];
         $foreignKey = $relation[2];
         if ($type == CActiveRecord::HAS_MANY) {
             foreach ($model->{$relationName} as $subModel) {
                 if (!empty($subModel)) {
                     $this->processModel($subModel);
                 }
             }
         } elseif ($type == CActiveRecord::HAS_ONE) {
             if (!empty($model->{$relationName})) {
                 $this->processModel($model->{$relationName});
             }
         }
     }
     if ($delete) {
         $model->delete();
     }
 }
开发者ID:kostya1017,项目名称:our,代码行数:28,代码来源:RecursiveDeleteBehavior.php

示例4: relations

 public function relations()
 {
     return array_merge(parent::relations(), array('fiitFinv' => array(self::BELONGS_TO, 'FinvInvoice', 'fiit_finv_id'), 'fiitFprc' => array(self::BELONGS_TO, 'FprcProductCategory', 'fiit_fprc_id'), 'fiitFqnt' => array(self::BELONGS_TO, 'FqntQuantity', 'fiit_fqnt_id'), 'fiitFvat' => array(self::BELONGS_TO, 'FvatVat', 'fiit_fvat_id'), 'fixrFiitXRefs' => array(self::HAS_MANY, 'FixrFiitXRef', 'fixr_fiit_id')));
 }
开发者ID:dbrisinajumi,项目名称:d2finv,代码行数:4,代码来源:BaseFiitInvoiceItem.php

示例5: relations

 public function relations()
 {
     return array_merge(parent::relations(), array('tsthTstt' => array(self::BELONGS_TO, 'TsttStatus', 'tsth_tstt_id'), 'tsthPprs' => array(self::BELONGS_TO, 'PprsPerson', 'tsth_pprs_id'), 'tsthTtsk' => array(self::BELONGS_TO, 'TtskTask', 'tsth_ttsk_id')));
 }
开发者ID:dbrisinajumi,项目名称:d2tasks,代码行数:4,代码来源:BaseTsthStatusHistory.php

示例6: relations

 public function relations()
 {
     return array_merge(parent::relations(), array('ccdpCcmp' => array(self::BELONGS_TO, 'CcmpCompany', 'ccdp_ccmp_id')));
 }
开发者ID:dbrisinajumi,项目名称:d2company,代码行数:4,代码来源:BaseCcdpDepartment.php

示例7: relations

 public function relations()
 {
     return array_merge(parent::relations(), array('vtlsTrailerServices' => array(self::HAS_MANY, 'VtlsTrailerService', 'vtls_vtrl_id'), 'vtrdTrailerDocs' => array(self::HAS_MANY, 'VtrdTrailerDoc', 'vtrd_vtrl_id'), 'vtrlVtrt' => array(self::BELONGS_TO, 'VtrtTrailerType', 'vtrl_vtrt_id'), 'vtrlCcmp' => array(self::BELONGS_TO, 'CcmpCompany', 'vtrl_ccmp_id'), 'vvoyVoyages' => array(self::HAS_MANY, 'VvoyVoyage', 'vvoy_vtrl_id')));
 }
开发者ID:dbrisinajumi,项目名称:trucks,代码行数:4,代码来源:BaseVtrlTrailer.php

示例8: relations

 public function relations()
 {
     return array_merge(parent::relations(), array('tcmnCommunications' => array(self::HAS_MANY, 'TcmnCommunication', 'tcmn_tmed_id')));
 }
开发者ID:dbrisinajumi,项目名称:d2tasks,代码行数:4,代码来源:BaseTmedMedia.php

示例9: relations

 /**
  * Returns the relations used for the model
  * @return array
  * @see AccountModule::modelMap
  */
 public function relations()
 {
     /** @var AccountModule $account */
     $account = Yii::app()->getModule('account');
     if (!empty($account->modelMap[get_class($this)]['relations'])) {
         return $account->modelMap[get_class($this)]['relations'];
     }
     return parent::relations();
 }
开发者ID:cornernote,项目名称:yii-account-module,代码行数:14,代码来源:AccountActiveRecord.php

示例10: relations

 public function relations()
 {
     return array_merge(parent::relations(), array('fddaDimDatas' => array(self::HAS_MANY, 'FddaDimData', 'fdda_fdm2_id'), 'fddpDimDataPeriods' => array(self::HAS_MANY, 'FddpDimDataPeriod', 'fddp_fdm2_id'), 'fdm2Fret' => array(self::BELONGS_TO, 'FretRefType', 'fdm2_fret_id'), 'fdm2Fdm1' => array(self::BELONGS_TO, 'Fdm1Dimension1', 'fdm2_fdm1_id'), 'fdm3Dimension3s' => array(self::HAS_MANY, 'Fdm3Dimension3', 'fdm3_fdm2_id'), 'fdspDimensionSplits' => array(self::HAS_MANY, 'FdspDimensionSplit', 'fdsp_fdm2_id'), 'vdimDimensions' => array(self::HAS_MANY, 'VdimDimension', 'vdim_fdm2_id'), 'vpdmPlaningDimensions' => array(self::HAS_MANY, 'VpdmPlaningDimension', 'vpdm_fdm2_id')));
 }
开发者ID:dbrisinajumi,项目名称:d2fixr,代码行数:4,代码来源:BaseFdm2Dimension2.php

示例11: relations

 public function relations()
 {
     return array_merge(parent::relations(), array('authassignments' => array(self::HAS_MANY, 'Authassignment', 'itemname'), 'authitemchildren' => array(self::HAS_MANY, 'Authitemchild', 'child'), 'authitemchildren1' => array(self::HAS_MANY, 'Authitemchild', 'parent'), 'rights' => array(self::HAS_MANY, 'Rights', 'itemname'), 'stfaFlowAccesses' => array(self::HAS_MANY, 'StfaFlowAccess', 'stfa_authitem')));
 }
开发者ID:uldisn,项目名称:yii-user,代码行数:4,代码来源:BaseAuthitem.php

示例12: relations

 /**
  * Returns the relations used for the model
  *
  * @return array
  * @see AuditModule::modelMap
  */
 public function relations()
 {
     $audit = Yii::app()->getModule('audit');
     if (!empty($audit->modelMap[get_class($this)]['relations'])) {
         return $audit->modelMap[get_class($this)]['relations'];
     }
     return parent::relations();
 }
开发者ID:Horlacher,项目名称:yii-audit-module,代码行数:14,代码来源:AuditActiveRecord.php

示例13: relations

 /**
  * Returns the relations used for the model
  *
  * @return array
  * @see MenuModule::modelMap
  */
 public function relations()
 {
     $menu = Yii::app()->getModule('menu');
     if (!empty($menu->modelMap[get_class($this)]['relations'])) {
         return $menu->modelMap[get_class($this)]['relations'];
     }
     return parent::relations();
 }
开发者ID:rizaldi-github,项目名称:yii-menu-module,代码行数:14,代码来源:MenuActiveRecord.php

示例14: relations

 public function relations()
 {
     return array_merge(parent::relations(), array('fpeoPeriodOdos' => array(self::HAS_MANY, 'FpeoPeriodOdo', 'fpeo_vodo_id'), 'vodoVtrc' => array(self::BELONGS_TO, 'VtrcTruck', 'vodo_vtrc_id')));
 }
开发者ID:dbrisinajumi,项目名称:trucks,代码行数:4,代码来源:BaseVodoOdometer.php

示例15: relations

 public function relations()
 {
     return array_merge(parent::relations(), array('variants' => array(self::HAS_MANY, 'EavVariant', 'attribute_id', 'order' => 'variants.title'), 'activeVariants' => array(self::HAS_MANY, 'EavVariant', 'attribute_id', 'order' => 'activeVariants.title', 'scopes' => 'active'), 'existingVariants' => array(self::HAS_MANY, 'EavVariant', 'attribute_id', 'join' => 'LEFT JOIN {{eav_attribute_value}} `av` ON `existingVariants`.`id` = `av`.`variant_value`', 'condition' => '`av`.`variant_value` IS NOT NULL', 'order' => '`existingVariants`.`title`', 'scopes' => 'active'), 'variantsCount' => array(self::STAT, 'EavVariant', 'attribute_id')));
 }
开发者ID:kuzmina-mariya,项目名称:4seasons,代码行数:4,代码来源:EavAttribute.php


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