public function fullLoad() { if ($this->getUserId()) { $user = new User(); $user->load($this->getUserId()); $this->setUserName($user->getName() . ' ' . $user->getSecondName()); } if ($this->getPatientId()) { $patient = new Patient(); $patient->load($this->getPatientId()); $this->setPatientName($patient->getName() . ' ' . $patient->getSecondName()); } if ($this->getDiseaseId()) { $disease = new Disease(); $disease->load($this->getDiseaseId()); $this->setTitle($disease->getTitle()); } }
/** * Save data. * * @param Request $request * @return \Symfony\Component\HttpFoundation\RedirectResponse */ public function saveAction(Request $request) { $this->check(); $data = $request->request->all(); $disease = new Disease(); if (empty($data['id'])) { unset($data['id']); } else { $disease->load($data['id']); } $disease->setData($data); $disease->save(); return $this->redirectToRoute('disease_homepage', array('id' => $disease->getId())); }