Files
myep-team/src/Controller/Administrative/Teamer/ProfileController.php
T
2025-08-21 14:20:43 +02:00

39 lines
1.2 KiB
PHP

<?php
namespace App\Controller\Administrative\Teamer;
use App\Controller\Traits\ReturnUrlTrait;
use App\Entity\Teamer;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
class ProfileController extends AbstractController
{
use ReturnUrlTrait;
public function __construct(private readonly EntityManagerInterface $entityManager)
{
}
#[Route('/administrative/teamer/profile/{uuid}', name: 'app_administrative_teamer_profile')]
#[IsGranted('ROLE_ADMINISTRATIVE')]
public function index(Teamer $teamer, Request $request): Response
{
if (false === $teamer->isViewed()) {
$teamer->setViewed(true);
$this->entityManager->flush();
}
$returnUrl = $this->getReturnUrl($request, 'app_administrative_teamer_index');
return $this->render('administrative/teamer/profile.html.twig', [
'teamer' => $teamer,
'returnUrl' => $returnUrl,
]);
}
}