61 lines
1.9 KiB
PHP
61 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Controller\Teamer\Assignment;
|
|
|
|
use App\Controller\Traits\ReturnUrlTrait;
|
|
use App\Entity\Assignment;
|
|
use App\Entity\User;
|
|
use App\Repository\ApplicationRepository;
|
|
use App\Repository\DispositionRepository;
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
use Symfony\Component\Routing\Annotation\Route;
|
|
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
|
|
|
class DetailController extends AbstractController
|
|
{
|
|
use ReturnUrlTrait;
|
|
|
|
public function __construct(
|
|
private readonly ApplicationRepository $applicationRepository,
|
|
private readonly DispositionRepository $dispositionRepository
|
|
) {
|
|
}
|
|
|
|
#[Route('/teamer/assignment/{uuid}', name: 'app_teamer_assignment_detail')]
|
|
#[IsGranted('ROLE_TEAMER')]
|
|
public function index(Assignment $assignment, Request $request): Response
|
|
{
|
|
/** @var User $user */
|
|
$user = $this->getUser();
|
|
$teamer = $user->getTeamer();
|
|
|
|
$application = $this
|
|
->applicationRepository
|
|
->findOneBy([
|
|
'assignment' => $assignment,
|
|
'teamer' => $teamer,
|
|
])
|
|
;
|
|
|
|
$disposition = $this
|
|
->dispositionRepository
|
|
->findOneBy([
|
|
'assignment' => $assignment,
|
|
'teamer' => $teamer,
|
|
])
|
|
;
|
|
|
|
$isBookmarked = $teamer->getBookmarks()->contains($assignment);
|
|
|
|
return $this->render('teamer/assignment/detail.html.twig', [
|
|
'teamer' => $teamer,
|
|
'assignment' => $assignment,
|
|
'disposition' => $disposition,
|
|
'application' => $application,
|
|
'isBookmarked' => $isBookmarked,
|
|
'returnUrl' => $this->getReturnUrl($request, 'app_teamer_index'),
|
|
]);
|
|
}
|
|
} |