src/Controller/RecipeController.php line 42

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\Routing\Annotation\Route;
  5. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  6. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
  7. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Entity;
  8. use Doctrine\ORM\EntityManagerInterface;
  9. use App\Entity\Recipe;
  10. class RecipeController extends AbstractController
  11. {
  12.     /**
  13.      * @Route(
  14.      *      "/recettes", 
  15.      *      name="recipes", 
  16.      *  )
  17.      * @Template("frontend/recipes/list.html.twig")
  18.      */
  19.     public function recipes(EntityManagerInterface $em){
  20.         $twigData = array();
  21.         $twigData['hideSideMenu'] = true;
  22.         $twigData['forceFooter']=true;
  23.         $twigData['posts'] = $em->getRepository(Recipe::class)->findValidRecipes();
  24.         return $twigData;
  25.     }
  26.     /**
  27.      * @Route("/recettes/voir/{title}/{id}", 
  28.      *          name="viewRecipe",
  29.      *          defaults = {
  30.      *              "title" = false,
  31.      *          },
  32.      *      )
  33.      * @Template("frontend/recipes/view.html.twig")
  34.      */
  35.     public function viewPost(EntityManagerInterface $em$titleRecipe $post){
  36.         $twigData = array();
  37.         $twigData['hideSideMenu'] = true;
  38.         $twigData['post'] = $post;
  39.         $twigData['forceFooter']=true;
  40.         return $twigData;
  41.     }
  42. }