<?php
namespace App\Controller;
use App\Entity\Carousel;
use App\Entity\Home;
use App\Entity\PressReleases;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class HomeController extends AbstractController {
/**
* @Route("/", name="homepage")
*/
public function indexAction(){
$press_repo1 = $this->getDoctrine()
->getRepository(PressReleases::class)
->findOneBy(['orderBy' => 1, 'published' => 1]);
$press_repo2 = $this->getDoctrine()
->getRepository(PressReleases::class)
->findOneBy(['orderBy' => 2, 'published' => 1]);
$press_repo3 = $this->getDoctrine()
->getRepository(PressReleases::class)
->findOneBy(['orderBy' => 3, 'published' => 1]);
$carousel_repo = $this->getDoctrine()->getRepository(Carousel::class)->findAll();
$home_repo = $this->getDoctrine()->getRepository(Home::class)->find(1);
return $this->render('frontend/index.html.twig',
[
'press1_data' => $press_repo1,
'press2_data' => $press_repo2,
'press3_data' => $press_repo3,
'carousel_data' => $carousel_repo,
'home_data' => $home_repo,
'page' => 'home'
]);
}
}