Exemplo n.º 1
0
 protected function createPost($topic, $body, $author)
 {
     $post = new Post();
     $post->setTopic($topic);
     $post->setCreatedBy($author);
     $post->setCreatedDate(new \DateTime());
     $post->setDeleted(false);
     $post->setBody($body);
     return $post;
 }
 /**
  *
  * @access protected
  * @param \CCDNForum\ForumBundle\Entity\Post $post
  */
 protected function onSuccess(Post $post)
 {
     $post->setCreatedDate(new \DateTime());
     if ($this->anon) {
         $post->setAnonName($post->GetAnonName());
     } else {
         $post->setCreatedBy($this->user);
     }
     $post->setTopic($this->topic);
     $post->setDeleted(false);
     $this->dispatcher->dispatch(ForumEvents::USER_TOPIC_REPLY_SUCCESS, new UserTopicEvent($this->request, $post->getTopic()));
     $this->postModel->savePost($post);
     $this->dispatcher->dispatch(ForumEvents::USER_TOPIC_REPLY_COMPLETE, new UserTopicEvent($this->request, $this->topic, $this->didAuthorSubscribe()));
 }