<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Request;
use App\Repository\UserRepository;
class DefaultController extends AbstractController
{
public $mode = "SAV";
#[Route('/', name: 'app_default')]
public function index(): Response
{
return $this->redirectToRoute('app_repertoire');
}
#[Route('/ChangeMode/{modeOperation}', name: 'ChangeMode')]
public function ChangeMode($modeOperation, UserRepository $userRepository ,Request $request): Response
{
$user = $this->getUser();
if($modeOperation == "PROD") $user->setMode("PROD");
if($modeOperation == "SAV") $user->setMode("SAV");
$userRepository->add($user, true);
if($modeOperation == "PROD") $user->setMode("PROD");
if($modeOperation == "SAV") $user->setMode("SAV");
return $this->redirectToRoute('app_repertoire');
}
#[Route('/memo', name: 'memo')]
public function memo(): Response
{
phpinfo();
die();
}
}