public function setStatus($name, $save = true)
{
if (!($status = OphTrOperationbooking_Operation_Status::model()->find('name=?', array($name)))) {
throw new Exception('Invalid status: ' . $name);
}
$this->status_id = $status->id;
if ($save && !$this->save()) {
throw new Exception('Unable to change operation status: ' . print_r($this->getErrors(), true));
}
}