updrade with rector

This commit is contained in:
2022-05-03 14:52:04 +02:00
parent d1e613ecc6
commit 6e30560cb9
135 changed files with 5609 additions and 4008 deletions

View File

@@ -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',
]);
}
}