src/Controller/HomeController.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Carousel;
  4. use App\Entity\Home;
  5. use App\Entity\PressReleases;
  6. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  7. use Symfony\Component\HttpFoundation\Request;
  8. use Symfony\Component\HttpFoundation\Response;
  9. use Symfony\Component\Routing\Annotation\Route;
  10. class HomeController extends AbstractController {
  11.     /**
  12.      * @Route("/", name="homepage")
  13.      */
  14.     public function indexAction(){
  15.         $press_repo1 $this->getDoctrine()
  16.             ->getRepository(PressReleases::class)
  17.             ->findOneBy(['orderBy' => 1'published' => 1]);
  18.         $press_repo2 $this->getDoctrine()
  19.             ->getRepository(PressReleases::class)
  20.             ->findOneBy(['orderBy' => 2'published' => 1]);
  21.         $press_repo3 $this->getDoctrine()
  22.             ->getRepository(PressReleases::class)
  23.             ->findOneBy(['orderBy' => 3'published' => 1]);
  24.         $carousel_repo $this->getDoctrine()->getRepository(Carousel::class)->findAll();
  25.         $home_repo $this->getDoctrine()->getRepository(Home::class)->find(1);
  26.         return $this->render('frontend/index.html.twig',
  27.             [
  28.                 'press1_data' => $press_repo1,
  29.                 'press2_data' => $press_repo2,
  30.                 'press3_data' => $press_repo3,
  31.                 'carousel_data' => $carousel_repo,
  32.                 'home_data' => $home_repo,
  33.                 'page' => 'home'
  34.             ]);
  35.     }
  36. }