src/Controller/PageController.php line 21

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Page;
  4. use Doctrine\Persistence\ManagerRegistry;
  5. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  6. use Symfony\Component\HttpFoundation\Request;
  7. use Symfony\Component\HttpFoundation\Response;
  8. use Symfony\Component\Routing\Annotation\Route;
  9. class PageController extends AbstractController
  10. {
  11.     #[Route(path'/{slug}'name'custom_page_show'priority: -200)]
  12.     public function showAction(string $slugRequest $requestManagerRegistry $managerRegistry): Response
  13.     {
  14.         $company $request->get('companyInner');
  15.         $page $managerRegistry->getRepository(Page::class)->getOneActiveBySlugAndCompany($slug$company);
  16.         if (!$page) {
  17.             throw $this->createNotFoundException('Page not found');
  18.         }
  19.         return $this->render('pages/custom_page/custom_page.html.twig', [
  20.             'customPage' => $page,
  21.             'metaInfo' => $page,
  22.         ]);
  23.     }
  24. }