public function blame(TutorialInterface $tutorial) { if (null === $this->securityContext->getToken()) { throw new \RuntimeException('You must configure a firewall for this route'); } if ($this->securityContext->isGranted('IS_AUTHENTICATED_REMEMBERED')) { $tutorial->setAuthor($this->securityContext->getToken()->getUser()); } }
public function getCommentCount(TutorialInterface $tutorial) { $threadRepo = $this->em->getRepository('ProtonCommentBundle:Thread'); $thread = $threadRepo->findOneBy(array('id' => $tutorial->getSlug())); return $thread->getNumComments(); }