/** * @Route("/registreer", name="registreren") */ public function indexRegistreer(Request $request) { // create a task and give it some dummy data for this example $task = new Patient(); $task->setNaam(''); $form = $this->createFormBuilder($task)->add('naam', 'text')->add('voornaam', 'text')->add('email', 'email')->add('save', 'submit', array('label' => 'Registreer'))->getForm(); $form->handleRequest($request); if ($form->isValid()) { // perform some action, such as saving the task to the database $naam = $form["Naam"]->getData(); $voornaam = $form["Voornaam"]->getData(); $email = $form["Email"]->getData(); $patient = new Patient(); $patient->setNaam($naam); $patient > setVoornaam($voornaam); $patient->setEmail($email); $em = $this->getDoctrine()->getManager(); $em->persist($patient); $em->flush(); $success = 'successvol geregistreerd'; return $this->redirectToRoute('/registreer', array('success' => $success)); } return $this->render('default/registreer.html.twig', array('form' => $form->createView())); }
private function createDeleteForm(Patient $patient) { return $this->createFormBuilder()->setAction($this->generateUrl('deletePatient', array('id' => $patient->getId())))->setMethod('DELETE')->getForm(); }