24 lines
612 B
PHP
24 lines
612 B
PHP
<?php
|
|
|
|
namespace App\Controller\FrontEnd;
|
|
|
|
use App\Entity\Page;
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
use Symfony\Component\Routing\Attribute\Route;
|
|
|
|
final class PageController extends AbstractController
|
|
{
|
|
#[Route('/{url:page}', name: 'front_end_page')]
|
|
public function index(Page $page): Response
|
|
{
|
|
if ($page->isPublished()) {
|
|
return $this->render('front/page/index.html.twig', [
|
|
'page' => $page
|
|
]);
|
|
}
|
|
|
|
return new Response('<h1>Page not found</h1>');
|
|
}
|
|
}
|