Jelajahi Sumber

Correction ordre descendant pour les articles

Sangfroid 2 bulan lalu
induk
melakukan
a167091627
1 mengubah file dengan 1 tambahan dan 1 penghapusan
  1. 1 1
      src/Controller/IndexController.php

+ 1 - 1
src/Controller/IndexController.php

@@ -12,7 +12,7 @@ class IndexController extends AbstractController
     #[Route('/', name: 'app_index')]
     public function index(ArticleRepository $articleRepository): Response
     {
-        $articles = $articleRepository->findBy(['state' => 'published']);
+        $articles = $articleRepository->findBy(criteria: ['state' => 'published'], orderBy: ['publicationDate' => 'DESC']);
 
         return $this->render('index/index.html.twig', [
             'articles'  => $articles