/** * 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(); }
/** * @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; }
/** * 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(); } }
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'))); }
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'))); }
public function relations() { return array_merge(parent::relations(), array('vtdcVtdt' => array(self::BELONGS_TO, 'VtdtTruckDocType', 'vtdc_vtdt_id'), 'vtdcVtrc' => array(self::BELONGS_TO, 'VtrcTruck', 'vtdc_vtrc_id'), 'vtdcFixr' => array(self::BELONGS_TO, 'FixrFiitXRef', 'vtdc_fixr_id'))); }
public function relations() { return array_merge(parent::relations(), array('ccdpCcmp' => array(self::BELONGS_TO, 'CcmpCompany', 'ccdp_ccmp_id'))); }
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'))); }
public function relations() { return array_merge(parent::relations(), array('tcmnCommunications' => array(self::HAS_MANY, 'TcmnCommunication', 'tcmn_tmed_id'))); }
/** * 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(); }
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'))); }
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'))); }
public function relations() { return array_merge(parent::relations(), array('ppxtPersonXTypes' => array(self::HAS_MANY, 'PpxtPersonXType', 'ppxt_ptyp_id'))); }
/** * 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(); }
/** * 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(); }
public function relations() { return array_merge(parent::relations(), array('vtrsFixr' => array(self::BELONGS_TO, 'FixrFiitXRef', 'vtrs_fixr_id'), 'vtrsVtrc' => array(self::BELONGS_TO, 'VtrcTruck', 'vtrs_vtrc_id'), 'vtrsVsrv' => array(self::BELONGS_TO, 'VsrvServices', 'vtrs_vsrv_id'))); }
public function relations() { return array_merge(parent::relations(), array('ccucUserCompanies' => array(self::HAS_MANY, 'CcucUserCompany', 'ccuc_cucp_id'))); }
public function relations() { return array_merge(parent::relations(), array('ppxsPersonXSettings' => array(self::HAS_MANY, 'PpxsPersonXSetting', 'ppxs_psty_id'))); }
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'))); }
public function relations() { return array_merge(parent::relations(), array('ecntContainers' => array(self::HAS_MANY, 'EcntContainer', 'ecnt_etpr_id'))); }
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'))); }
public function relations() { return array_merge(parent::relations(), array('fixrFiitXRefs' => array(self::HAS_MANY, 'FixrFiitXRef', 'fixr_period_fret_id'))); }
public function relations() { return array_merge(parent::relations(), array('ccucUserCompanies' => array(self::HAS_MANY, 'CcucUserCompany', 'ccuc_person_id'), 'user' => array(self::BELONGS_TO, 'User', 'user_id'))); }
public function relations() { return array_merge(parent::relations(), array('itemname0' => array(self::BELONGS_TO, 'Authitem', 'itemname'))); }
public function relations() { return array_merge(parent::relations(), array('ppxtPtyp' => array(self::BELONGS_TO, 'PtypType', 'ppxt_ptyp_id'), 'ppxtPprs' => array(self::BELONGS_TO, 'PprsPerson', 'ppxt_pprs_id'))); }
public function relations() { return array_merge(parent::relations(), array('vtrdFixr' => array(self::BELONGS_TO, 'FixrFiitXRef', 'vtrd_fixr_id'), 'vtrdVtdt' => array(self::BELONGS_TO, 'VtdtTruckDocType', 'vtrd_vtdt_id'), 'vtrdVtrl' => array(self::BELONGS_TO, 'VtrlTrailer', 'vtrd_vtrl_id'))); }
public function relations() { return array_merge(parent::relations(), array('fddpDimDataPeriods' => array(self::HAS_MANY, 'FddpDimDataPeriod', 'fddp_fdpe_id'))); }
public function relations() { return array_merge(parent::relations(), array('tcmnTtsk' => array(self::BELONGS_TO, 'TtskTask', 'tcmn_ttsk_id'), 'tcmnPprs' => array(self::BELONGS_TO, 'PprsPerson', 'tcmn_pprs_id'), 'tcmnClientPprs' => array(self::BELONGS_TO, 'PprsPerson', 'tcmn_client_pprs_id'), 'tcmnTcst' => array(self::BELONGS_TO, 'TcstCommunicationStatus', 'tcmn_tcst_id'), 'tcmnTmed' => array(self::BELONGS_TO, 'TmedMedia', 'tcmn_tmed_id'), 'tcshComminicationStatusHistories' => array(self::HAS_MANY, 'TcshComminicationStatusHistory', 'tcsh_tcmn_id'))); }
public function relations() { return array_merge(parent::relations(), array('pfOrderItemNotes' => array(self::HAS_MANY, 'PfOrderItemNotes', 'order_item_id'), 'order' => array(self::BELONGS_TO, 'PfOrder', 'order_id'), 'manufakturerCcmp' => array(self::BELONGS_TO, 'CcmpCompany', 'manufakturer_ccmp_id'))); }
public function relations() { return array_merge(parent::relations(), array('ecntContainer' => array(self::HAS_MANY, 'EcntContainer', 'cctc_code'))); }