當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。