43 lines
1.2 KiB
PHP
43 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Controller;
|
|
|
|
use App\Entity\Pages;
|
|
use App\Repository\PagesRepository;
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
use Symfony\Component\Routing\Annotation\Route;
|
|
|
|
class PagesController extends AbstractController
|
|
{
|
|
#[Route(path: '/pages/{name}', name: 'pages_display')]
|
|
public function display(PagesRepository $pagesRepository, string $name): Response
|
|
{
|
|
$page = $pagesRepository->findOneBy([
|
|
'slug' => $name,
|
|
]);
|
|
|
|
if (!$page) {
|
|
$page = new Pages();
|
|
$page->setName(name: 'Not Found');
|
|
$page->setContent(content: 'The requested page was not found.');
|
|
}
|
|
|
|
return $this->render(view: '@default/pages/display.html.twig', parameters: [
|
|
'page' => $page,
|
|
]);
|
|
}
|
|
|
|
#[Route(path: '/imprint', name: 'app_imprint')]
|
|
public function imprint(): Response
|
|
{
|
|
return $this->render(view: '@default/pages/imprint.html.twig');
|
|
}
|
|
|
|
#[Route(path: '/privacy', name: 'app_privacy')]
|
|
public function privacy(): Response
|
|
{
|
|
return $this->render(view: '@default/pages/privacy.html.twig');
|
|
}
|
|
}
|