/** * @param $idReservation * @return Reservation * @throws Exception */ public function remove($idReservation) { $idReservation = (int) $idReservation; if (in_array($idReservation, $this->_session->ids)) { /** * @var Reservation $reservation */ $reservation = Reservation::getById($idReservation); if ($reservation && $reservation->isNew()) { $reservation->setDeclinedByVisitor(); $reservation->save(); return $reservation; } } throw new Exception('Cannot remove invalid reservation'); }
public function editAction() { parent::editAction(); $this->_entity = Reservation::getById($this->_getParam('id')); if ($this->getRequest()->isPost()) { $data = (object) $this->getRequest()->getPost(); try { $this->__setData($data); $this->_entity->save(); $this->__goBack(); } catch (Exception $e) { $this->__postFields(); $this->view->showMessage($e->getMessage()); } } else { $this->__postFields(); } }
/** * @return Application_Model_Medical_Reservation|null */ public function getFrom() { return Application_Model_Medical_Reservation::getById($this->getIdFrom()); }