src/Controller/ContentController.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Content;
  4. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  5. use Symfony\Component\HttpFoundation\Request;
  6. use Symfony\Component\HttpFoundation\Response;
  7. use Symfony\Component\Routing\Annotation\Route;
  8. class ContentController extends AbstractController {
  9.     /**
  10.      * @Route("/content/{id}/{title}", name="content_page")
  11.      */
  12.     public function getContent($id$title)
  13.     {
  14.         $repo $this->getDoctrine()->getRepository(Content::class)->findOneBy(['id' => $id]);
  15.         return $this->render('frontend/content.html.twig',
  16.         [
  17.             'content' => $repo,
  18.             'page' => $title
  19.         ]);
  20.     }
  21. }