src/Controller/ArticlesController.php line 15

Open in your IDE?
  1. <?php
  2. // src/Controller/ArticlesController.php
  3. namespace App\Controller;
  4. use Symfony\Component\HttpFoundation\Response;
  5. use Symfony\Component\Routing\Annotation\Route;
  6. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  7. class ArticlesController extends AbstractController
  8. {
  9.     /**
  10.      * @Route("/", name="app_start")
  11.      * @Route("/nyheter", name="app_articles")
  12.      */
  13.     public function articles()
  14.     {
  15.         $articles $this->getDoctrine()->getManager()->getRepository('App\Entity\Article')->findBy([], [
  16.             'published' => 'DESC'
  17.         ]);
  18.         return $this->render('articles.html.twig', [
  19.             'articles' => $articles
  20.         ]);
  21.     }
  22. }