src/Controller/AdminController.php line 26

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\User;
  4. use App\Enum\SiteEnum;
  5. use App\Kernel;
  6. use App\Repository\PointsCatalog\CatalogOrderRepository;
  7. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  8. use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
  9. use Symfony\Component\HttpFoundation\RedirectResponse;
  10. use Symfony\Component\HttpFoundation\Request;
  11. use Symfony\Component\HttpFoundation\Response;
  12. use Symfony\Component\HttpKernel\KernelInterface;
  13. use Symfony\Component\Routing\Annotation\Route;
  14. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  15. /**
  16.  * @Route("/admin")
  17.  */
  18. class AdminController extends AbstractController
  19. {
  20.     /**
  21.      * @Route("/login", name="admin_login")
  22.      */
  23.     public function login(AuthenticationUtils $authenticationUtilsRequest $request): Response
  24.     {
  25.         // get the login error if there is one
  26.         $error $authenticationUtils->getLastAuthenticationError();
  27.         // last username entered by the user
  28.         $lastUsername $authenticationUtils->getLastUsername();
  29.         return $this->render('admin/login.html.twig', [
  30.             'last_username' => $lastUsername,
  31.             'error' => $error,
  32.         ]);
  33.     }
  34.     /**
  35.      * @Route("/test-email-template", name="admin_test_email_template")
  36.      */
  37.     public function testEmailTemplate(KernelInterface $kernelCatalogOrderRepository $catalogOrderRepository): Response
  38.     {
  39.         if (Kernel::DEV_ENV !== $kernel->getEnvironment()) {
  40.             throw $this->createAccessDeniedException();
  41.         }
  42.         $order $catalogOrderRepository->find(992);
  43.         return $this->render('mails/catalog_gift_orders/notify_provider_catalog_gift_order_created_by_garage.html.twig', [
  44.             'order' => $order,
  45.             'admin_name' => 'n',
  46.         ]);
  47.     }
  48.     /**
  49.      * @Route("/after-logout", name="admin_after_logout")
  50.      */
  51.     public function afterLogout(ParameterBagInterface $pbRequest $request): RedirectResponse
  52.     {
  53.         $url $pb->get('old_frontend_uri_es');
  54.         if (SiteEnum::SITE_STR_PT === $request->getLocale()) {
  55.             $url $pb->get('old_frontend_uri_pt');
  56.         }
  57.         return $this->redirect($url);
  58.     }
  59. }