Files
myep-team/src/Controller/Teamer/IndexController.php
T

61 lines
1.8 KiB
PHP

<?php
namespace App\Controller\Teamer;
use App\Entity\Application;
use App\Entity\Assignment;
use App\Entity\Disposition;
use App\Entity\Feedback;
use App\Entity\User;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
class IndexController extends AbstractController
{
public function __construct(private readonly EntityManagerInterface $entityManager)
{
}
#[Route('/teamer', name: 'app_teamer_index')]
#[IsGranted('ROLE_TEAMER')]
public function index(): Response
{
/** @var User $user */
$user = $this->getUser();
$teamer = $user->getTeamer();
$matchingAssignments = $this
->entityManager
->getRepository(Assignment::class)
->getNewMatchingTeamerProfile($teamer)
;
$recentFeedback = $this
->entityManager
->getRepository(Feedback::class)
->getRecentForTeamer($teamer)
;
$pendingApplications = $this
->entityManager
->getRepository(Application::class)
->getPendingForTeamer($teamer)
;
$upcomingDispositions = $this
->entityManager
->getRepository(Disposition::class)
->getUpcomingDispositionsByTeamer($teamer)
;
return $this->render('teamer/index.html.twig', [
'matchingAssignments' => $matchingAssignments,
'recentFeedback' => $recentFeedback,
'pendingApplications' => $pendingApplications,
'upcomingDispositions' => $upcomingDispositions,
]);
}
}