<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Response;
class FrontendController extends AbstractController
{
/**
* @Route("/", name="homepage")
*/
public function index()
{
$em = $this->getDoctrine()->getManager();
$articles = $em->getRepository('App:MzkgActualite')->findBy([],['id'=>'DESC'],3);
return $this->render('frontend/index.html.twig',['articles'=>$articles]);
}
/**
* @Route("/historique", name="historique")
*/
public function historique()
{
return $this->render('frontend/historique.html.twig',[]);
}
/**
* @Route("/gouvernance", name="gouvernance")
*/
public function gouvernance()
{
return $this->render('frontend/gouvernance.html.twig',[]);
}
/**
* @Route("/adn", name="adn")
*/
public function adn()
{
return $this->render('frontend/adn.html.twig',[]);
}
/**
* @Route("/nosmetiers", name="nos-metiers")
*/
public function nosmetiers()
{
$em = $this->getDoctrine()->getManager();
return $this->render('frontend/nosmetiers.html.twig',[]);
}
/**
* @Route("/associations", name="associations")
*/
public function associations()
{
return $this->render('frontend/associations.html.twig');
}
/**
* @Route("/representation", name="representation")
*/
public function representation()
{
return $this->render('frontend/representation.html.twig');
}
/**
* @Route("/contact", name="contact")
*/
public function contact()
{
return $this->render('frontend/contact.html.twig',['evenement'=>'contact']);
}
/**
* @Route("/actualites", name="actualites")
*/
public function actualites()
{
$em = $this->getDoctrine()->getManager();
$articles = $em->getRepository('App:MzkgActualite')->findBy([],['id'=>'DESC']);
return $this->render('frontend/actualites.html.twig',['articles'=>$articles]);
}
/**
* @Route("/article/{slug}", name="article")
*/
public function article($slug)
{
$em = $this->getDoctrine()->getManager();
$article = $em->getRepository('App:MzkgActualite')->findOneBy(['slug'=>$slug],['id'=>'DESC']);
$articles = $em->getRepository('App:MzkgActualite')->findBy([],['id'=>'DESC'],3);
return $this->render('frontend/article.html.twig',['article'=>$article,'articles'=>$articles]);
}
}