<?php
namespace App\Controller\Front;
use App\Entity\CoursLangue;
use App\Entity\Post;
use App\Entity\PostCategory;
use App\Services\PagesManager;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use DateTime;
class CoursLangueController extends AbstractController
{
/**
* @Route("/cours-anglais", name="page_cours_anglais")
* Method ({"GET", "POST"})
*/
public function anglais(PagesManager $pagesManager): Response
{
$page = $this->getDoctrine()->getManager()->getRepository(Post::class)->findOneBySlug('cours-anglais');
return $this->render('front/cours_langue/anglais.html.twig', [
'blocs' => $pagesManager->getPageBlocs($page)
]);
}
/**
* @Route("/cours-francais", name="page_cours_francais")
* Method ({"GET", "POST"})
*/
public function francais(PagesManager $pagesManager): Response
{
$page = $this->getDoctrine()->getManager()->getRepository(Post::class)->findOneBySlug('cours-francais');
return $this->render('front/cours_langue/francais.html.twig', [
'blocs' => $pagesManager->getPageBlocs($page)
]);
}
/**
* @Route("/cours-langue/anglais/{slug}", name="page_anglais_cours_list")
* Method ({"GET", "POST"})
*/
public function anglaisCoursList($slug): Response
{
$em = $this->getDoctrine()->getManager();
$category = $em->getRepository(PostCategory::class)->findOneBySlug($slug);
$cours = $em->getRepository(CoursLangue::class)->findByCategory($category);
return $this->render('front/cours_langue/anglais_cours_list.html.twig', [
'cours' => $cours,
'category' => $category
]);
}
/**
* @Route("/cours-langue/francais/{slug}", name="page_francais_cours_list")
* Method ({"GET", "POST"})
*/
public function francaisCoursList($slug): Response
{
$em = $this->getDoctrine()->getManager();
$category = $em->getRepository(PostCategory::class)->findOneBySlug($slug);
$cours = $em->getRepository(CoursLangue::class)->findByCategory($category);
return $this->render('front/cours_langue/francais_cours_list.html.twig', [
'cours' => $cours,
'category' => $category
]);
}
/**
* @Route("/cours-langue/anglais/reservation/{slug}", name="page_anglais_cours_reservation")
* Method ({"GET", "POST"})
*/
public function anglaisShow($slug): Response
{
$em = $this->getDoctrine()->getManager();
$cour = $em->getRepository(CoursLangue::class)->findOneBySlug($slug);
return $this->render('front/cours_langue/anglais_show.html.twig', [
'cour' => $cour
]);
}
/**
* @Route("/cours-langue/francais/reservation/{slug}", name="page_francais_cours_reservation")
* Method ({"GET", "POST"})
*/
public function francaisShow($slug): Response
{
$em = $this->getDoctrine()->getManager();
$cour = $em->getRepository(CoursLangue::class)->findOneBySlug($slug);
return $this->render('front/cours_langue/francais_show.html.twig', [
'cour' => $cour
]);
}
}