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(); } }
private function _save() { $this->_reservation->setLastSyncTime(DateTime::currentTimestamp()); $this->_reservation->save(); }
private function _buildReservation(Reservation $reservation) { $reservation->setDoctor($this->_doctor); $reservation->setDesiredVisitTime($this->_fromTime->getTimestamp()); $reservation->setFinalVisitTime($this->_fromTime->getTimestamp()); $reservation->setVisitEndTime($this->_toTime->getTimestamp()); $reservation->setVisitorName($this->_data->visitorName); $reservation->setVisitorPhone($this->_data->visitorPhone); $serviceCollection = $reservation->getServiceCollection(); foreach ($this->_services as $service) { $serviceCollection->add($service); } $reservation->setStatus($reservation::STATUS_NEW); $reservation->save(); return $reservation; }