src/Controller/PrivacyPagesController.php line 36
<?php
namespace App\Controller;
use App\Controller\Traits\HreflangsControllerTrait;
use App\Controller\Traits\MetatagsControllerTrait;
use App\Controller\Traits\StaticPageHelperTrait;
use App\Entity\Magazine;
use App\Entity\PrivacyPolicy;
use App\Entity\ProductType;
use App\Entity\Recipe;
use App\Entity\StaticPage;
use App\Repository\MagazineRepository;
use App\Repository\RecipeRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Contracts\Translation\TranslatorInterface;
class PrivacyPagesController extends AbstractController
{
use MetatagsControllerTrait, HreflangsControllerTrait, StaticPageHelperTrait;
private $em;
private $transalor;
public function __construct(EntityManagerInterface $em, TranslatorInterface $translator){
$this->em = $em;
$this->transalor = $translator;
}
#[Route(['/privacy-policy-mod-is',
'en' => '/en/privacy-policy-mod-is',
// 'es' => '/es/política-de-privacidad-mod-is',
], name: 'privacy_policy_is')]
public function privacyPolicyIs(Request $request, EntityManagerInterface $em)
{
list ($metatags, $hreflangs) = $this->getStaticPageMetatagsAndHreflangs($request, $em, $this->getParameter('locales'));
$privacyPolicy = $this->em->getRepository(PrivacyPolicy::class)->findOneBy([
'locale' => $request->getLocale(),
'type' => 0
]);
if(!$privacyPolicy instanceof PrivacyPolicy){
throw $this->createNotFoundException();
}
return $this->render('default/privacyPolicy.html.twig', [
'privacy_policy' => $privacyPolicy,
'metatags' => $metatags,
'hreflangs' => $hreflangs
]);
}
#[Route(path: ['/privacy-policy-de',
'de' => '/de/privacy-policy-de'], name: 'privacy-policy-de')]
public function privacyPolicyDE(Request $request, EntityManagerInterface $em)
{
// list ($metatags, $hreflangs) = $this->getStaticPageMetatagsAndHreflangs($request, $em, $this->getParameter('locales'));
return $this->render('default/privacyPolicyDE.html.twig', [
// 'metatags' => $metatags,
// 'hreflangs' => $hreflangs
]);
}
#[Route(['/privacy-policy-mod-icont',
'en' => '/en/privacy-policy-mod-icont',
// 'es' => '/es/política-de-privacidad-mod-icont',
], name: 'privacy_policy_icont')]
public function privacyPolicyIcont(Request $request, EntityManagerInterface $em)
{
list ($metatags, $hreflangs) = $this->getStaticPageMetatagsAndHreflangs($request, $em, $this->getParameter('locales'));
$privacyPolicy = $this->em->getRepository(PrivacyPolicy::class)->findOneBy([
'locale' => $request->getLocale(),
'type' => 1
]);
if(!$privacyPolicy instanceof PrivacyPolicy){
throw $this->createNotFoundException();
}
return $this->render('default/privacyPolicy.html.twig', [
'privacy_policy' => $privacyPolicy,
'metatags' => $metatags,
'hreflangs' => $hreflangs
]);
}
#[Route(['it' => '/privacy-policy-mod-icv',
// 'en' => '/en/privacy-policy-mod-icv',
// 'es' => '/es/política-de-privacidad-mod-icv',
], name: 'privacy_policy_icv')]
public function privacyPolicyIcv(Request $request, EntityManagerInterface $em)
{
list ($metatags, $hreflangs) = $this->getStaticPageMetatagsAndHreflangs($request, $em, ['it']);
$privacyPolicy = $this->em->getRepository(PrivacyPolicy::class)->findOneBy([
'locale' => $request->getLocale(),
'type' => 2
]);
if(!$privacyPolicy instanceof PrivacyPolicy){
throw $this->createNotFoundException();
}
return $this->render('default/privacyPolicy.html.twig', [
'privacy_policy' => $privacyPolicy,
'metatags' => $metatags,
'hreflangs' => $hreflangs
]);
}
#[Route(['it' => '/privacy-policy-mod-iwb-ext',
// 'en' => '/en/privacy-policy-mod-iwb-ext',
// 'es' => '/es/privacy-policy-mod-iwb-ext',
], name: 'privacy_policy_mod_iwb_ext')]
public function privacyPolicyIwbExt(Request $request, EntityManagerInterface $em)
{
list ($metatags, $hreflangs) = $this->getStaticPageMetatagsAndHreflangs($request, $em, ['it']);
$privacyPolicy = $this->em->getRepository(PrivacyPolicy::class)->findOneBy([
'locale' => $request->getLocale(),
'type' => 3
]);
if(!$privacyPolicy instanceof PrivacyPolicy){
throw $this->createNotFoundException();
}
return $this->render('default/privacyPolicy.html.twig', [
'privacy_policy' => $privacyPolicy,
'metatags' => $metatags,
'hreflangs' => $hreflangs
]);
}
}