src/Controller/ServiciosController.php line 58
<?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;class ServiciosController extends AbstractController{#[Route(path: ['es' => '/servicios','en' => '/en/services'], name: 'servicios')]public function servicios(Request $request, PersistenceManagerRegistry $doctrine): Response{$locale=$request->getLocale();$em = $doctrine->getManager();// $servicios = $em->getRepository('App\Entity\Contenido')->findAll();$servicios = $em->getRepository('App\Entity\ContenidoServicio')->findByEstado(Contenido::ESTADO_PUBLICADO,['position' => 'ASC']);$ruta = $em->getRepository('App\Entity\Ruta')->findOneById("servicio_url");// dump(->translate($locale)); die();$returnArray = array('servicios' => $servicios,'ruta' => $ruta->translate($locale));return $this->render('default/servicios.html.twig', $returnArray);}#[Route(path: ['es' => '/servicios/{slug}','en' => '/en/services/{slug}'], name: 'servicio')]public function servicio(Request $request, PersistenceManagerRegistry $doctrine, $slug): Response{$id = Contenido::getSlugId($slug);$local=$request->getLocale();$em = $doctrine->getManager();// $servicios = $em->getRepository('App\Entity\Contenido')->findAll();$servicio = $em->getRepository('App\Entity\ContenidoServicio')->findOneBy(["estado" => Contenido::ESTADO_PUBLICADO, "id" => $id]);$returnArray = array('servicio' => $servicio);return $this->render('default/servicio.html.twig', $returnArray);}}