public function newAction(Request $request) { $this->check(); $id = $request->get('id'); $diseases = new DiseaseCollection(); $users = new UserCollection(); $patient = new Patient(); $patient->load($id); $data = array(); $data['diseases'] = $diseases->getAllItemsData(); $data['users'] = $users->getAllItemsData(); if ($patient->getId()) { $data['patients'] = $patient->getData(); } else { $patient = new PatientCollection(); $data['patients'] = $patient->getAllItemsData(); } return $this->render('PatientDiseaseBundle:Default:patientdiseaseedit.html.twig', array('data' => $data, 'user' => $this->getUserDataHeader($request->getSession()), 'template_type' => 'New')); }
public function loadAction() { $new = new PatientCollection(); $data['items'] = $new->getAllItemsData(); return new Response(json_encode($data)); }