1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
namespace App\Controller;
use App\Entity\Groupe;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
class GroupeController extends AbstractController
{
private $em;
public function __construct(EntityManagerInterface $em)
{
$this->em = $em;
}
/**
* @Route("/groupes", name="liste_groupe")
*/
public function listeGroupeAction()
{
return $this->render('groupe/liste.html.twig', array(
'groupes' => $this->em->getRepository(Groupe::class)->findBy(array('enabled' => true), array('createdAt' => 'DESC'))
));
}
/**
* @Route("/groupe/{slug}", name="show_groupe")
*/
public function showGroupeAction(Groupe $groupe)
{
return $this->render('groupe/show.html.twig', array(
'groupe' => $groupe
));
}
}