src/Controller/PrivacyPagesController.php line 36

  1. <?php
  2. namespace App\Controller;
  3. use App\Controller\Traits\HreflangsControllerTrait;
  4. use App\Controller\Traits\MetatagsControllerTrait;
  5. use App\Controller\Traits\StaticPageHelperTrait;
  6. use App\Entity\Magazine;
  7. use App\Entity\PrivacyPolicy;
  8. use App\Entity\ProductType;
  9. use App\Entity\Recipe;
  10. use App\Entity\StaticPage;
  11. use App\Repository\MagazineRepository;
  12. use App\Repository\RecipeRepository;
  13. use Doctrine\ORM\EntityManagerInterface;
  14. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  15. use Symfony\Component\HttpFoundation\Request;
  16. use Symfony\Component\Routing\Annotation\Route;
  17. use Symfony\Contracts\Translation\TranslatorInterface;
  18. class PrivacyPagesController extends AbstractController
  19. {
  20.     use MetatagsControllerTraitHreflangsControllerTraitStaticPageHelperTrait;
  21.     private $em;
  22.     private $transalor;
  23.     public function __construct(EntityManagerInterface $emTranslatorInterface $translator){
  24.         $this->em $em;
  25.         $this->transalor $translator;
  26.     }
  27.     #[Route(['/privacy-policy-mod-is',
  28.             'en' => '/en/privacy-policy-mod-is',
  29. //            'es' => '/es/política-de-privacidad-mod-is',
  30.             ], name'privacy_policy_is')]
  31.     public function privacyPolicyIs(Request $requestEntityManagerInterface $em)
  32.     {
  33.         list ($metatags$hreflangs) = $this->getStaticPageMetatagsAndHreflangs($request$em$this->getParameter('locales'));
  34.         $privacyPolicy $this->em->getRepository(PrivacyPolicy::class)->findOneBy([
  35.             'locale' => $request->getLocale(),
  36.             'type' => 0
  37.         ]);
  38.         if(!$privacyPolicy instanceof PrivacyPolicy){
  39.             throw $this->createNotFoundException();
  40.         }
  41.         return $this->render('default/privacyPolicy.html.twig', [
  42.             'privacy_policy' => $privacyPolicy,
  43.             'metatags' => $metatags,
  44.             'hreflangs' => $hreflangs
  45.         ]);
  46.     }
  47.     #[Route(path: ['/privacy-policy-de',
  48.         'de' => '/de/privacy-policy-de'], name'privacy-policy-de')]
  49.     public function privacyPolicyDE(Request $requestEntityManagerInterface $em)
  50.     {
  51.         // list ($metatags, $hreflangs) = $this->getStaticPageMetatagsAndHreflangs($request, $em, $this->getParameter('locales'));
  52.         return $this->render('default/privacyPolicyDE.html.twig', [
  53.             // 'metatags' => $metatags,
  54.             // 'hreflangs' => $hreflangs
  55.         ]);
  56.     }
  57.    #[Route(['/privacy-policy-mod-icont',
  58.        'en' => '/en/privacy-policy-mod-icont',
  59. //       'es' => '/es/política-de-privacidad-mod-icont',
  60.    ], name'privacy_policy_icont')]
  61.    public function privacyPolicyIcont(Request $requestEntityManagerInterface $em)
  62.    {
  63.        list ($metatags$hreflangs) = $this->getStaticPageMetatagsAndHreflangs($request$em$this->getParameter('locales'));
  64.        $privacyPolicy $this->em->getRepository(PrivacyPolicy::class)->findOneBy([
  65.             'locale' => $request->getLocale(),
  66.             'type' => 1
  67.         ]);
  68.         if(!$privacyPolicy instanceof PrivacyPolicy){
  69.             throw $this->createNotFoundException();
  70.         }
  71.        return $this->render('default/privacyPolicy.html.twig', [
  72.             'privacy_policy' => $privacyPolicy,
  73.             'metatags' => $metatags,
  74.             'hreflangs' => $hreflangs
  75.        ]);
  76.    }
  77.    #[Route(['it' => '/privacy-policy-mod-icv',
  78. //        'en' => '/en/privacy-policy-mod-icv',
  79. //        'es' => '/es/política-de-privacidad-mod-icv',
  80.    ], name'privacy_policy_icv')]
  81.    public function privacyPolicyIcv(Request $requestEntityManagerInterface $em)
  82.    {
  83.        list ($metatags$hreflangs) = $this->getStaticPageMetatagsAndHreflangs($request$em, ['it']);
  84.        $privacyPolicy $this->em->getRepository(PrivacyPolicy::class)->findOneBy([
  85.             'locale' => $request->getLocale(),
  86.             'type' => 2
  87.         ]);
  88.         if(!$privacyPolicy instanceof PrivacyPolicy){
  89.             throw $this->createNotFoundException();
  90.         }
  91.        return $this->render('default/privacyPolicy.html.twig', [
  92.             'privacy_policy' => $privacyPolicy,
  93.             'metatags' => $metatags,
  94.             'hreflangs' => $hreflangs
  95.        ]);
  96.    }
  97.    #[Route(['it' => '/privacy-policy-mod-iwb-ext',
  98. //        'en' => '/en/privacy-policy-mod-iwb-ext',
  99. //        'es' => '/es/privacy-policy-mod-iwb-ext',
  100.    ], name'privacy_policy_mod_iwb_ext')]
  101.    public function privacyPolicyIwbExt(Request $requestEntityManagerInterface $em)
  102.    {
  103.        list ($metatags$hreflangs) = $this->getStaticPageMetatagsAndHreflangs($request$em, ['it']);
  104.        $privacyPolicy $this->em->getRepository(PrivacyPolicy::class)->findOneBy([
  105.             'locale' => $request->getLocale(),
  106.             'type' => 3
  107.         ]);
  108.         if(!$privacyPolicy instanceof PrivacyPolicy){
  109.             throw $this->createNotFoundException();
  110.         }
  111.        return $this->render('default/privacyPolicy.html.twig', [
  112.             'privacy_policy' => $privacyPolicy,
  113.             'metatags' => $metatags,
  114.             'hreflangs' => $hreflangs
  115.        ]);
  116.    }
  117. }