ComptoirController.php 1.29 KB
Newer Older
1 2 3 4
<?php

namespace App\Controller;

5 6
use App\Entity\Comptoir;
use Doctrine\ORM\EntityManagerInterface;
7 8 9 10 11
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;

class ComptoirController extends AbstractController
{
12 13 14 15 16 17 18
    private $em;

    public function __construct(EntityManagerInterface $em)
    {
        $this->em = $em;
    }

19 20 21 22 23 24
    /**
     * @Route("/comptoirs/liste", name="comptoirs_liste")
     */
    public function listeComptoirAction()
    {
        return $this->render('comptoir/liste.html.twig', array(
25
            'comptoirs' => $this->em->getRepository(Comptoir::class)->findBy(array('enabled' => true), array('createdAt' => 'DESC'))
26 27 28 29 30 31 32 33 34
        ));
    }

    /**
     * @Route("/comptoirs/carte", name="comptoirs_carte")
     */
    public function carteComptoirAction()
    {
        return $this->render('comptoir/carte.html.twig', array(
35
            'comptoirs' => $this->em->getRepository(Comptoir::class)->findBy(array('enabled' => true), array('createdAt' => 'DESC'))
36 37
        ));
    }
38 39 40 41 42 43 44 45 46 47 48

    /**
     * @Route("/comptoir/{slug}", name="show_comptoir")
     */
    public function showGroupeAction(Comptoir $comptoir)
    {
        return $this->render('comptoir/show.html.twig', array(
            'comptoir' => $comptoir
        ));
    }

49
}