コード例 #1
0
 /**
  *
  */
 public function remove(TopicInterface $topic, $andFlush = true)
 {
     $category = $topic->getCategory();
     $this->logger->debug(sprintf('Removing all posts associated with topic: %s.', $topic->getId()));
     $posts = $this->TopicManager->findAllByTopic($topic);
     $this->TopicManager->removeAll($posts);
     $this->logger->debug(sprintf('Removing topic: %s.', $topic->getId()));
     $this->objectManager->remove($topic);
     if ($andFlush) {
         $this->objectManager->flush();
         //$this->categoryUpdater->update($category);
     }
 }
コード例 #2
0
 public function findPositionByTopicAndPost(TopicInterface $topic, PostInterface $post)
 {
     $qb = $this->createQueryBuilder()->field('_id')->lt(new \MongoId($post->getId()))->field('topic.$id')->equals(new \MongoId($topic->getId()))->sort('created', 'ASC')->count();
     $query = $qb->getQuery();
     return $query->execute();
 }
コード例 #3
0
 public function createPost(PostInterface $post, TopicInterface $topic, $user)
 {
     $socialContext = $topic->getSocialContext();
     $post->setAuthor($user);
     $post->setSocialContext($socialContext);
     $post->setTopic($topic);
     $this->update($post);
     return $post;
 }
コード例 #4
0
 /**
  * Returns the uniform resource location (URL) of the topic.
  *
  * @param ForumInterface $forum the forum.
  * @param TopicInterface $topic the topic.
  * @return the uniform resource location (URL) of the topic.
  */
 protected function getTopicUrl(ForumInterface $forum, TopicInterface $topic)
 {
     $route = 'rhapsody_forum_topic_view';
     $url = $this->router->generate($route, array('forum' => $forum->getId(), 'topic' => $topic->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
     return $url;
 }