-
-
Save JKetelaar/f8af6a4850b915dc62adefec77ab17ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Displays User Dashboard | |
* | |
* @param Request $request | |
* @return \Symfony\Component\HttpFoundation\Response | |
* | |
* @Route("/") | |
*/ | |
public function indexAction(Request $request) | |
{ | |
$user = $this->get('user_service')->getUser(); | |
if ($user->isDentist()) { | |
$appointments = $this->get('user_service')->getUser()->getDentistAppointments(); | |
} else { | |
if ($user->isHygienist()) { | |
$appointments = $this->get('user_service')->getUser()->getHygienistAppointments(); | |
} else { | |
$appointments = $this->get('user_service')->getUser()->getAppointments(); | |
} | |
} | |
$manager = $this->getDoctrine()->getEntityManager(); | |
foreach($appointments as $appointment){ | |
$manager->remove($appointment); | |
} | |
$manager->flush(); | |
//TODO: Add Upcoming Appointments Notification [Within 7 Days of Today] | |
return $this->render( | |
'@App/dashboard.html.twig', | |
['appointments' => $appointments, 'user' => $user] | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment