Init project
This commit is contained in:
30
src/Controller/RenderFeatureController.php
Normal file
30
src/Controller/RenderFeatureController.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\News;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
#[Route('/render/feature', name: 'render_feature_')]
|
||||
final class RenderFeatureController extends AbstractController
|
||||
{
|
||||
private EntityManagerInterface $entityManager;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
$this->entityManager = $entityManager;
|
||||
}
|
||||
|
||||
#[Route('/news', name: 'news')]
|
||||
public function news($isCarousel): Response
|
||||
{
|
||||
$news = $this->entityManager->getRepository(News::class)->findBy([], ['ordre' => 'ASC']);
|
||||
return $this->render('render_feature/news.html.twig', [
|
||||
'news' => $news,
|
||||
'isCarousel' => $isCarousel
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user