Advertisement
Guest User

HomeController

a guest
Jul 27th, 2018
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.60 KB | None | 0 0
  1. <?php
  2.  
  3. namespace SoftUniBlogBundle\Controller;
  4.  
  5. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  6. use SoftUniBlogBundle\Entity\Article;
  7. use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  8.  
  9. class HomeController extends Controller
  10. {
  11.     /**
  12.      * @Route("/", name="blog_index")
  13.      * @return \Symfony\Component\HttpFoundation\Response
  14.      */
  15.     public function articles(){
  16.         $repos =  $this->getDoctrine()->getRepository(Article::class);
  17.         $articles = $repos->findAll();
  18.         return $this->render('default/index.html.twig', ['articles' => $articles]);
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement