Element_OphTrOperationnote_ProcedureList::afterSave PHP Method

afterSave() protected method

For new records, set the episode status and (if relevant) the operation status.
protected afterSave ( )
    protected function afterSave()
    {
        if ($this->getIsNewRecord()) {
            $this->event->episode->episode_status_id = 4;
            if (!$this->event->episode->save()) {
                throw new Exception('Unable to change episode status for episode ' . $this->event->episode->id);
            }
            if ($this->booking_event_id && ($api = Yii::app()->moduleAPI->get('OphTrOperationbooking'))) {
                $api->setOperationStatus($this->booking_event_id, 'Completed');
            }
        }
        return parent::afterSave();
    }