src/Controller/ContenidoController.php line 35
<?phpnamespace App\Controller;use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;use Symfony\Component\HttpFoundation\Request;use Symfony\Component\HttpFoundation\Response;use Symfony\Component\Routing\Annotation\Route;use Symfony\Component\HttpFoundation\JsonResponse;use Symfony\Component\HttpFoundation\ResponseHeaderBag;use Symfony\Component\HttpFoundation\BinaryFileResponse;use Symfony\Contracts\Translation\TranslatorInterface;use Doctrine\ORM\EntityManagerInterface;use Knp\Component\Pager\PaginatorInterface;use Symfony\Component\HttpFoundation\Cookie;use Symfony\Component\HttpFoundation\RequestStack;use Doctrine\Persistence\ManagerRegistry as PersistenceManagerRegistry;use Symfony\Component\Cache\Adapter\FilesystemAdapter;use Symfony\Contracts\Cache\ItemInterface;use App\Entity\Contenido;use App\Services\ConfigurationManager;use App\Services\SettingsManager;class ContenidoController extends AbstractController{#[Route(path: ['es' => '/cms/{slug}','en' => '/en/cms/{slug}'], name: 'cms')]public function pagina(Request $request,PersistenceManagerRegistry $doctrine, $slug, $_locale, TranslatorInterface $translator): Response{$id = Contenido::getSlugId($slug);$em = $doctrine->getManager();$contenido = false;$promociones = [];if ($id) {if ($this->getUser() and (in_array('ROLE_ADMIN', $this->getUser()->getRoles(), true) or in_array('ROLE_SUPER_ADMIN', $this->getUser()->getRoles(), true)))$contenido = $em->getRepository('App\Entity\Contenido')->ContenidoByIdIdiomaTipoQuery($id,$_locale,Contenido::TIPO_PAGINA,false,true);else$contenido = $em->getRepository('App\Entity\Contenido')->ContenidoByIdIdiomaTipoQuery($id,$_locale,Contenido::TIPO_PAGINA);}if (!$contenido)throw $this->createNotFoundException('No existe la página');switch($contenido->getClave()) {case 'contacto':$template = 'default/cms/contacto.html.twig';break;case 'afiliados':$template = 'default/cms/afiliados.html.twig';break;case 'anunciantes':$template = 'default/cms/anunciantes.html.twig';break;case 'ser_agente':$template = 'default/cms/ser_agente.html.twig';break;case 'rrhh':$template = 'default/cms/rrhh.html.twig';break;case 'club':$template = 'default/cms/club.html.twig';$promociones = $em->getRepository('App\Entity\Promocion')->findByActiva(true);break;default:$template = 'default/cms.html.twig';}$response = $this->render($template, ['contenido' => $contenido,'promociones' => $promociones]);return $response;}}