src/FoundersBundle/Controller/MainController.php line 18

Open in your IDE?
  1. <?php
  2. namespace FoundersBundle\Controller;
  3. use Doctrine\ORM\EntityManagerInterface;
  4. use FoundersBundle\Model\Post;
  5. use Symfony\Component\HttpFoundation\Request;
  6. use Symfony\Component\HttpFoundation\Response;
  7. use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
  8. class MainController extends BaseController
  9. {
  10.     public function __construct(EntityManagerInterface $em)
  11.     {
  12.         parent::__construct($em);
  13.     }
  14.     public function index(Request $requestPost $postModel): Response
  15.     {
  16.         $posts $postModel->getPostsWithLimit(6);
  17.         if (!$posts) {
  18.             throw new NotFoundHttpException();
  19.         }
  20.         return $this->baseFounderController('@Founders/Main/index.html.twig', [
  21.             'posts' => $posts,
  22.         ]);
  23.     }
  24. }