src/Controller/DashboardController.php line 28

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Award;
  4. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  5. use Symfony\Component\HttpFoundation\Response;
  6. use Symfony\Component\Routing\Annotation\Route;
  7. use App\Service\EmailSender;
  8. use App\Entity\Application;
  9. use App\Entity\ApplicationReport;
  10. use App\Entity\ChangeRequest;
  11. class DashboardController extends AbstractController
  12. {
  13. private $sender;
  14. public function __construct(EmailSender $sender)
  15. {
  16. $this->sender = $sender;
  17. }
  18. /**
  19. * @Route("/", name="dashboard")
  20. * @return Response
  21. */
  22. public function dashboard()
  23. {
  24. $openAwards = $this->getDoctrine()
  25. ->getRepository(Award::class)
  26. ->findAllOpen();
  27. $applicationRoles = $this->getUser()->getFilteredApplicationRoles();
  28. $changeRequests = [];
  29. $currentUser = $this->getUser();
  30. $currentUserID = $currentUser->getId();
  31. $changeRequests = $this->getDoctrine()
  32. ->getRepository(ChangeRequest::class)
  33. ->findByAssignedTo($currentUserID);
  34. return $this->render('dashboard/dashboard.html.twig',
  35. [
  36. 'awards' => $openAwards,
  37. 'roles' => $applicationRoles,
  38. 'changeRequests' => $changeRequests
  39. ]
  40. );
  41. }
  42. /**
  43. * @Route("/send-reg-email", name="reg_email")
  44. * @return Response
  45. */
  46. public function sendReg(EmailSender $sender)
  47. {
  48. $sender->sendRegisteredEmail();
  49. return new Response('<body></body>');
  50. }
  51. }