Skip to content

Commit 89352e8

Browse files
committed
feature #381 Ensure default Post sort order shows newer Posts first (simensen)
This PR was merged into the master branch. Discussion ---------- Ensure default Post sort order shows newer Posts first In at least #223 the topic of sorting on the **admin backend** was mentioned. This is the first time I've loaded the demo app in quite awhile and wasn't sure it was working because I didn't realize the new post I had added was going to show up at the bottom of the list. It may not be a problem for everyone but the bottom of the list on my laptop was well past the fold. I appreciate that we do not need to make this **admin backend** fully completed with pagination and column-by-column sorting and what-not. However, I think it would make sense to have newer posts showing up at the top. Commits ------- 87584a6 Ensure default Post sort order shows newer Posts first
2 parents eaf516c + 87584a6 commit 89352e8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/AppBundle/Controller/Admin/BlogController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class BlogController extends Controller
5454
public function indexAction()
5555
{
5656
$entityManager = $this->getDoctrine()->getManager();
57-
$posts = $entityManager->getRepository(Post::class)->findAll();
57+
$posts = $entityManager->getRepository(Post::class)->findBy([], ['publishedAt' => 'DESC']);
5858

5959
return $this->render('admin/blog/index.html.twig', ['posts' => $posts]);
6060
}

0 commit comments

Comments
 (0)