<?php
namespace App\Controller\Front;
use App\Entity\Post;
use App\Repository\PostRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
/**
* Class PostController
* @package App\Controller\Front
*
* @Route("/news")
*/
class PostController extends AbstractController
{
/**
* @Route("/liste", name="front_post_list")
*/
public function list(PostRepository $postRepository)
{
return $this->render('front/post/list.html.twig', [
'posts' => $postRepository->findBy([], ['id' => 'DESC'])
]);
}
/**
* @Route("/{slug}", name="front_post_single")
*/
public function single(Post $post)
{
return $this->render('front/post/single.html.twig', [
'post' => $post
]);
}
}