public function afterSave() { //registre transaction in dimensions if (!empty($this->vtrs_fixr_id)) { $vsrv = $this->vtrsVsrv; $vtrc = $this->vtrsVtrc; FddaDimData::registre($this->vtrs_fixr_id, $vsrv->vsrv_id, $vsrv->vsrv_name, $vtrc->vtrc_id, $vtrc->vtrc_car_reg_nr); } parent::afterSave(); }
public function afterSave() { /** * registre transaction in dimensions */ if (!empty($this->vtdc_fixr_id)) { $vtdt = $this->vtdcVtdt; $vtrc = $this->vtdcVtrc; FddaDimData::registre($this->vtdc_fixr_id, $vtdt->vtdt_id, $vtdt->vtdt_name, $vtrc->vtrc_id, $vtrc->vtrc_car_reg_nr); } parent::afterSave(); }
public function afterSave() { // /** // * registre transaction in dimensions // */ // // //get models // $fixr = $this->vtlsFixr; // if(empty($fixr->fixr_period_fret_id)){ // parent::afterSave(); // return; // } // // //get period // $attributes = array( // 'fped_fixr_id' => $fixr->fixr_id, // ); // $fped = FpedPeriodDate::model()->findByAttributes($attributes); // if(empty($fped)){ // parent::afterSave(); // return; // } // // $vsrv = $this->vtlsVsrv; // $vtrl = $this->vtlsVtrl; // // //save dim data // $fdda = FddaDimData::findByFixrId($fixr->fixr_id); // $fdda->fdda_fret_id = $fixr->fixr_position_fret_id; // $fdda->setFdm2Id($vsrv->vsrv_id, $vsrv->vsrv_name); // $fdda->setFdm3Id($vtrl->vtrl_id, $vtrl->vtrl_reg_nr); // $fdda->fdda_date_from = $fped->fped_start_date; // $fdda->fdda_date_to = $fped->fped_end_date; // $fdda->save(); $vsrv = $this->vtlsVsrv; $vtrl = $this->vtlsVtrl; //registre transaction in dimensions FddaDimData::registre($this->vtls_fixr_id, $vsrv->vsrv_id, $vsrv->vsrv_name, $vtrl->vtrl_id, $vtrl->vtrl_reg_nr); parent::afterSave(); }
public function beforeDelete() { //delete all in fret defined related records $model_fret = FretRefType::model()->findAll(); foreach ($model_fret as $fret) { $criteria = new CDbCriteria(); $criteria->compare($fret->fret_model_fixr_id_field, $this->fixr_id); $ref_model = new $fret->fret_model(); foreach ($ref_model->findAll($criteria) as $ref) { $ref->delete(); } } //delete related recrd from FddaDimData $criteria = new CDbCriteria(); $criteria->compare('fdda_fixr_id', $this->fixr_id); //$fdda = FddaDimData::model()->findAll($criteria); foreach (FddaDimData::model()->findAll($criteria) as $fdda) { $fdda->delete(); } return parent::beforeDelete(); }
/** * find existing model by fixr_id or create new model with setted fixr_id * @param int $fixr_id * @return \FddaDimData model */ public static function findByFixrId($fixr_id) { $criteria = new CDbCriteria(); $criteria->compare('fdda_fixr_id', $fixr_id); $model = FddaDimData::model()->find($criteria); if (empty($model)) { $model = new FddaDimData(); $model->fdda_fixr_id = $fixr_id; } return $model; }