Skip to content

Commit

Permalink
[9-14] ブログ記事一覧ページのアクション
Browse files Browse the repository at this point in the history
  • Loading branch information
hidenorigoto committed Dec 28, 2015
1 parent 4a5716c commit f40b34d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docs/lists/ch09/09-14.txt
@@ -0,0 +1,16 @@
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;

class BlogController extends Controller
{
/**
* @Route("/blog/")
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$blogArticleRepository = $em->getRepository('AppBundle:BlogArticle');
$blogList = $blogArticleRepository->findBy([], ['targetDate' => 'DESC']);

return $this->render('Blog/index.html.twig',
['blogList' => $blogList]);
}
14 changes: 14 additions & 0 deletions src/AppBundle/Controller/BlogController.php
Expand Up @@ -3,9 +3,23 @@
namespace AppBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;

class BlogController extends Controller
{
/**
* @Route("/blog/")
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$blogArticleRepository = $em->getRepository('AppBundle:BlogArticle');
$blogList = $blogArticleRepository->findBy([], ['targetDate' => 'DESC']);

return $this->render('Blog/index.html.twig',
['blogList' => $blogList]);
}

public function latestListAction()
{
$em = $this->getDoctrine()->getManager();
Expand Down

0 comments on commit f40b34d

Please sign in to comment.