public function afterSave()
{
// Update Episode status when outcome is saved
if ($this->status && $this->status->episode_status) {
if ($this->event->isLatestOfTypeInEpisode()) {
$this->event->episode->episode_status_id = $this->status->episode_status_id;
if (!$this->event->episode->save()) {
throw new Exception('Unable to save episode status: ' . print_r($this->event->episode->getErrors(), true));
}
}
}
parent::afterSave();
}