<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Entity;
use Doctrine\ORM\EntityManagerInterface;
use App\Entity\Recipe;
class RecipeController extends AbstractController
{
/**
* @Route(
* "/recettes",
* name="recipes",
* )
* @Template("frontend/recipes/list.html.twig")
*/
public function recipes(EntityManagerInterface $em){
$twigData = array();
$twigData['hideSideMenu'] = true;
$twigData['forceFooter']=true;
$twigData['posts'] = $em->getRepository(Recipe::class)->findValidRecipes();
return $twigData;
}
/**
* @Route("/recettes/voir/{title}/{id}",
* name="viewRecipe",
* defaults = {
* "title" = false,
* },
* )
* @Template("frontend/recipes/view.html.twig")
*/
public function viewPost(EntityManagerInterface $em, $title, Recipe $post){
$twigData = array();
$twigData['hideSideMenu'] = true;
$twigData['post'] = $post;
$twigData['forceFooter']=true;
return $twigData;
}
}