updrade with rector
This commit is contained in:
@@ -2,28 +2,29 @@
|
||||
|
||||
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: '/imprint', name: 'app_imprint')]
|
||||
public function imprint(): Response
|
||||
#[Route(path: '/pages/{name}', name: 'pages_display')]
|
||||
public function display(PagesRepository $pagesRepository, string $name): Response
|
||||
{
|
||||
return $this->render(view: 'pages/imprint.html.twig', parameters: [
|
||||
'controller_name' => 'PagesController',
|
||||
$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: 'pages/display.html.twig', parameters: [
|
||||
'page' => $page,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route(path: '/privacy', name: 'app_privacy')]
|
||||
public function privacy(): Response
|
||||
{
|
||||
return $this->render(view: 'pages/privacy.html.twig', parameters: [
|
||||
'controller_name' => 'PagesController',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user