/**
  * @Route("/reserveer/{uurindex}/{dagindex}/{arts}", name="reserveerroute")
  */
 public function reserveerAction(Request $request, $uurindex, $dagindex, $arts)
 {
     if (isset($_POST['submit'])) {
         $opmerking = $_POST['opmerkingArea'];
     }
     $today = date("Y-m-d");
     $date = date('Y-m-d', strtotime($today . '+' . $dagindex . 'days'));
     $time = date('9:00');
     $uur = date('h:i', strtotime($time) + 60 * 30 * $uurindex);
     $em = $this->getDoctrine()->getManager();
     $artsen = $em->getRepository('AppBundle:Arts')->findAll();
     foreach ($artsen as $item) {
         $test_string = $item->getNaam() . ' ' . $item->getActhernaam();
         if ($test_string == $arts) {
             $artsid = $item->getId();
         }
     }
     $artsdata = $em->getRepository('AppBundle:Arts')->find($artsid);
     $datum = date($date . ' ' . $uur);
     $user = $this->get('security.token_storage')->getToken()->getUser();
     $adduur = new Uren();
     $adduur->setOpmerkingen($opmerking);
     $adduur->setDatum($datum);
     $adduur->setUserid($user);
     $adduur->setArtsid($artsdata);
     $eme = $this->getDoctrine()->getManager();
     $eme->persist($adduur);
     $eme->flush();
     return $this->redirectToRoute('patientAfsprakenroute');
 }
 /**
  * @Route("/reserveerforarts/{uurindex}/{dagindex}/{dag}", name="blokroute")
  */
 public function blokAction(Request $request, $uurindex, $dagindex, $dag)
 {
     $today = date("Y-m-d");
     $date = date('Y-m-d', strtotime($today . '+' . $dagindex . 'days'));
     $time = date('9:00');
     $uur = date('h:i', strtotime($time) + 60 * 30 * $uurindex);
     $datum = date($date . ' ' . $uur);
     $user = $this->get('security.token_storage')->getToken()->getUser();
     $reposArtsen = $this->getDoctrine()->getRepository('AppBundle:Arts');
     $artsen = $reposArtsen->findAll();
     foreach ($artsen as $arts) {
         if ($arts->getUserid() == $user) {
             $sendarts = $arts;
         }
     }
     $adduur = new Uren();
     $adduur->setOpmerkingen('Geblokkeerd door arts');
     $adduur->setDatum($datum);
     $adduur->setUserid($user);
     $adduur->setArtsid($sendarts);
     $eme = $this->getDoctrine()->getManager();
     $eme->persist($adduur);
     $eme->flush();
     return $this->redirectToRoute('deleteappointmentsroute', array('dag' => $dag, 'index' => $dagindex));
 }