<?php
namespace App\Controller;
use App\Entity\Award;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use App\Service\EmailSender;
use App\Entity\Application;
use App\Entity\ApplicationReport;
use App\Entity\ChangeRequest;
class DashboardController extends AbstractController
{
private $sender;
public function __construct(EmailSender $sender)
{
$this->sender = $sender;
}
/**
* @Route("/", name="dashboard")
* @return Response
*/
public function dashboard()
{
$openAwards = $this->getDoctrine()
->getRepository(Award::class)
->findAllOpen();
$applicationRoles = $this->getUser()->getFilteredApplicationRoles();
$changeRequests = [];
$currentUser = $this->getUser();
$currentUserID = $currentUser->getId();
$changeRequests = $this->getDoctrine()
->getRepository(ChangeRequest::class)
->findByAssignedTo($currentUserID);
return $this->render('dashboard/dashboard.html.twig',
[
'awards' => $openAwards,
'roles' => $applicationRoles,
'changeRequests' => $changeRequests
]
);
}
/**
* @Route("/send-reg-email", name="reg_email")
* @return Response
*/
public function sendReg(EmailSender $sender)
{
$sender->sendRegisteredEmail();
return new Response('<body></body>');
}
}