/** * set a default display order for a new record. */ protected function afterConstruct() { parent::afterConstruct(); if (!$this->display_order) { $criteria = new CDbCriteria(); $criteria->order = 'display_order desc'; $criteria->limit = 1; $model = get_class($this); $bottom = $model::model()->find($criteria); if ($bottom) { $this->display_order = $bottom->display_order + 1; } else { $this->display_order = 1; } } }
/** * Make sure event date is set. */ protected function afterConstruct() { $this->event_date = date('Y-m-d H:i:s'); parent::afterConstruct(); }
/** * Add relation to OphTrOperationnote_ProcedureListOperationElement if it exists */ protected function afterConstruct() { $this->addOpNoteElementRelation(); parent::afterConstruct(); }