public function quoteText(PostInterface $post) { return $post->getText(); }
public function createTopic(TopicInterface $topic, PostInterface $post, $user) { $socialContext = $topic->getSocialContext(); // ** Set post properties. $this->logger->debug("Assigning author and topic reference to post."); $post->setAuthor($user); $post->setTopic($topic); $post->setSocialContext($socialContext); // ** Set topic properties. $this->logger->debug("Creating reference to post on topic."); $topic->setPost($post); $topic->setLastPost($post); $topic->setUser($user); // ** Update/persist the topic. $this->update($topic); return $topic; }
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(); }