src/PHPDish/Bundle/ForumBundle/Service/TopicManager.php
public function findFollowingThreadsTopicsQuery(UserInterface $user, Criteria $criteria = null)
    {
        $qb = $this->getTopicRepository()->createQueryBuilder('t')
            ->leftJoin('t.threads', 'tt')
            ->leftJoin('tt.followers', 'f')
            ->where('f.id = :userId')
            ->setParameter('userId', $user)
            ->orderBy('t.createdAt', 'desc');
        if ($criteria) {
            $qb->addCriteria($criteria);
        }
        return $qb->getQuery();
    }
public function findFollowingThreadsTopicsQuery(UserInterface $user, Criteria $criteria = null)
    {
        $qb = $this->getTopicRepository()->createQueryBuilder('t')
            ->leftJoin('t.threads', 'tt')
            ->leftJoin('tt.followers', 'f')
            ->where('f.id = :userId')
            ->setParameter('userId', $user)
            ->orderBy('t.createdAt', 'desc');
        if ($criteria) {
            $qb->addCriteria($criteria);
        }
        return $qb->getQuery();
    }
创建查询关注话题下的帖子query
@param UserInterface $user
@param Criteria|null $criteria
@return \Doctrine\ORM\Query
@throws \Doctrine\ORM\Query\QueryException