<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use App\Entity\Cbepage;
class CbepageController extends AbstractController
{
public function getPage($slug): Response
{
$em = $this->getDoctrine()->getManager();
$page = $em->getRepository(Cbepage::class)->findBy(array('slug' => $slug));
if (!$page) {
throw new NotFoundHttpException('Oops! Ha ocurrido un error. La página no se ha encontrado.');
}
return $this->render('cbepage/index.html.twig', [
'page' => $page[0]
]);
}
}