src/Controller/Management/Office/Select/ListController.php line 23
<?phpdeclare(strict_types=1);namespace App\Controller\Management\Office\Select;use App\Entity\Office\Office;use App\Service\Management\Office\OfficeSelectionService;use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;use Symfony\Component\HttpFoundation\Request;use Symfony\Component\HttpFoundation\Response;use Symfony\Component\Routing\Annotation\Route;#[Route(path: '/offices')]class ListController extends AbstractController{public function __construct(private OfficeSelectionService $officeSelectionService,) {}#[Route(path: '/list', name: 'management_office_list')]public function list(): Response{return $this->render('management/office/list.html.twig');}#[Route(path: '/select/{office}', name: 'management_office_select', methods: 'POST')]public function select(Request $request, Office $office): Response{$csrf = $request->get('token');if ($this->isCsrfTokenValid('office-selection', $csrf)) {$this->officeSelectionService->setSelectedOffice($office);}return $this->redirectToRoute('management_dashboard');}}