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();
}