Kaynağa Gözat

Ordre descendant pour l'édition aussi

Sangfroid 2 ay önce
ebeveyn
işleme
aa962dbab0
1 değiştirilmiş dosya ile 2 ekleme ve 1 silme
  1. 2 1
      src/Controller/ArticleController.php

+ 2 - 1
src/Controller/ArticleController.php

@@ -5,6 +5,7 @@ namespace App\Controller;
 use App\Entity\Article;
 use App\Form\ArticleType;
 use App\Repository\ArticleRepository;
+use Doctrine\Common\Collections\Order;
 use Doctrine\ORM\EntityManagerInterface;
 use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
 use Symfony\Component\DependencyInjection\Attribute\Target;
@@ -22,7 +23,7 @@ final class ArticleController extends AbstractController
     public function index(ArticleRepository $articleRepository): Response
     {
         return $this->render('article/index.html.twig', [
-            'articles' => $articleRepository->findAll(),
+            'articles' => $articleRepository->findBy(criteria: [], orderBy: ['publicationDate' => 'DESC']),
         ]);
     }