src/PHPDish/Bundle/ForumBundle/Controller/TopicController.php
public function indexAction(Request $request)
    {
        $manager = $this->getTopicManager();
        $criteria = Criteria::create();
        $criteria->orderBy(['isTop' => 'desc',  'lastCommentAt' => 'desc'])->where(Criteria::expr()->eq('enabled', true));

        $tab = $request->query->get('tab');
        if ($tab === 'following') {
            $this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED'); //关注的需要登录
            $topics = $manager->findFollowingThreadsTopics($this->getUser(), $request->query->getInt('page', 1));
        } else {
            if ($tab === 'recommend') {
                $criteria->andWhere(Criteria::expr()->eq('recommended', true));
            }
            $topics = $manager->findTopicsPager($criteria, $request->query->getInt('page', 1));
        }
//        return $this->render('@PHPDishWeb/Topic/index.html.twig', [
//            'topics' => $topics,
//        ]);
        return $this->render($this->configuration->getTemplate('Topic:index.html.twig'), [
            'topics' => $topics,
        ]);
    }
public function indexAction(Request $request)
    {
        $manager = $this->getTopicManager();
        $criteria = Criteria::create();
        $criteria->orderBy(['isTop' => 'desc',  'lastCommentAt' => 'desc'])->where(Criteria::expr()->eq('enabled', true));

        $tab = $request->query->get('tab');
        if ($tab === 'following') {
            $this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED'); //关注的需要登录
            $topics = $manager->findFollowingThreadsTopics($this->getUser(), $request->query->getInt('page', 1));
        } else {
            if ($tab === 'recommend') {
                $criteria->andWhere(Criteria::expr()->eq('recommended', true));
            }
            $topics = $manager->findTopicsPager($criteria, $request->query->getInt('page', 1));
        }
//        return $this->render('@PHPDishWeb/Topic/index.html.twig', [
//            'topics' => $topics,
//        ]);
        return $this->render($this->configuration->getTemplate('Topic:index.html.twig'), [
            'topics' => $topics,
        ]);
    }
话题列表.

@Route("/", name="homepage")
@Route("/topics", name="topic")

@param Request $request

@return Response