src/Controller/MainController.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\HttpFoundation\Request;
  5. use Symfony\Component\HttpFoundation\Response;
  6. use Symfony\Component\Routing\Annotation\Route;
  7. class MainController extends AbstractController
  8. {
  9.     #[Route('/change-locale/{locale}'name'change_locale')]
  10.     public function ChangeLocale($localeRequest $request): Response
  11.     {
  12.         $request->getSession()->set('_locale'$locale);
  13.         return $this->redirect($request->headers->get('referer'));
  14.     }
  15. }