/**
  * Render service edit view.
  *
  * @param Request $request
  * @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
  */
 public function editAction(Request $request)
 {
     $this->check();
     $id = $request->get('id');
     $service = new Service();
     $service->load($id);
     if ($service->getId()) {
         return $this->render('ServiceBundle:Default:serviceedit.html.twig', array('service' => $service->getData(), 'user' => $this->getUserDataHeader($request->getSession()), 'template_type' => 'Edit'));
     }
     return $this->redirectToRoute('service_new');
 }
示例#2
0
 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->getServiceId()) {
         $service = new Service();
         $service->load($this->getServiceId());
         $this->setTitle($service->getTitle());
         $this->setPrice($service->getPrice());
     }
 }