src/PHPDish/Bundle/PostBundle/Controller/PostController.php
public function recommendPostsAction($limit)
    {
        $criteria = Criteria::create()->orderBy(['isRecommended' => 'desc', 'createdAt' => 'desc'])
            ->andWhere(Criteria::expr()->gte('createdAt', Carbon::parse('-100 days')))
            ->setMaxResults($limit);
        $posts = $this->getPostManager()->findPosts($criteria);

        return $this->render($this->configuration->getTemplate('Post:recommend_posts.html.twig'), [
            'posts' => $posts,
        ]);
    }
public function recommendPostsAction($limit)
    {
        $criteria = Criteria::create()->orderBy(['isRecommended' => 'desc', 'createdAt' => 'desc'])
            ->andWhere(Criteria::expr()->gte('createdAt', Carbon::parse('-100 days')))
            ->setMaxResults($limit);
        $posts = $this->getPostManager()->findPosts($criteria);

        return $this->render($this->configuration->getTemplate('Post:recommend_posts.html.twig'), [
            'posts' => $posts,
        ]);
    }
推荐的文章.

@param int $limit

@return Response