Exemplo n.º 1
0
 /**
  *
  * @access public
  * @param  \Map2u\ForumBundle\Entity\Topic             $topic
  * @param  int                                             $userId
  * @return \Map2u\ForumBundle\Manager\ManagerInterface
  */
 public function unsubscribe(Topic $topic, $userId)
 {
     $subscription = $this->model->findOneSubscriptionForTopicByIdAndUserById($topic->getId(), $userId);
     if (!$subscription) {
         return $this;
     }
     $subscription->setSubscribed(false);
     $subscription->setRead(true);
     $this->gateway->saveSubscription($subscription);
     return $this;
 }
Exemplo n.º 2
0
 /**
  *
  * @access protected
  * @param  \Map2u\ForumBundle\Entity\Topic      $topic
  * @return null|\Map2u\ForumBundle\Entity\Board
  */
 private function extractBoardFromTopic(Topic $topic)
 {
     if ($topic) {
         if ($topic->getId()) {
             return $topic->getBoard();
         }
     }
     return null;
 }
Exemplo n.º 3
0
 /**
  *
  * @access public
  * @param  \Map2u\ForumBundle\Entity\Forum                        $forum
  * @param  \Map2u\ForumBundle\Entity\Topic                        $topic
  * @return \Map2u\ForumBundle\Component\Crumbs\Factory\CrumbTrail
  */
 public function addUserTopicShow(Forum $forum, Topic $topic)
 {
     return $this->addUserBoardShow($forum, $topic->getBoard())->add($topic->getTitle(), array('route' => 'ccdn_forum_user_topic_show', 'params' => array('forumName' => $forum->getName(), 'topicId' => $topic->getId())));
 }
Exemplo n.º 4
0
 /**
  *
  * @access protected
  * @param  string                                             $forumName
  * @param  \Map2u\ForumBundle\Entity\Topic                $topic
  * @param  \Map2u\ForumBundle\Entity\Post                 $post
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  */
 protected function redirectResponseForTopicOnPageFromPost($forumName, Topic $topic, Post $post)
 {
     //$page = $this->getTopicModel()->getPageForPostOnTopic($topic, $topic->getLastPost()); // Page of the last post.
     $response = $this->redirectResponse($this->path('ccdn_forum_user_topic_show', array('forumName' => $forumName, 'topicId' => $topic->getId())));
     return $response;
 }