public function newAction(Request $request)
 {
     $this->check();
     $id = $request->get('id');
     $services = new ServiceCollection();
     $users = new UserCollection();
     $patient = new Patient();
     $patient->load($id);
     $data = array();
     $data['services'] = $services->getAllItemsData();
     $data['users'] = $users->getAllItemsData();
     if ($patient->getId()) {
         $data['patients'] = $patient->getData();
     } else {
         $patient = new PatientCollection();
         $data['patients'] = $patient->getAllItemsData();
     }
     return $this->render('PatientServiceBundle:Default:patientserviceedit.html.twig', array('data' => $data, 'user' => $this->getUserDataHeader($request->getSession()), 'template_type' => 'New'));
 }
 /**
  * Load services collection and return as json.
  *
  * @return Response
  */
 public function loadAction()
 {
     $new = new ServiceCollection();
     $data['items'] = $new->getAllItemsData();
     return new Response(json_encode($data));
 }