/** * * @access protected * @param \Map2u\ForumBundle\Entity\Post $post */ protected function onSuccess(Post $post) { $post->setCreatedDate(new \DateTime()); $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())); }
/** * * @access protected * @param \Map2u\ForumBundle\Entity\Post $post */ protected function onSuccess(Post $post) { $post->setCreatedDate(new \DateTime()); $post->setCreatedBy($this->user); $post->setDeleted(false); $topic = $post->getTopic(); $topic->setCachedViewCount(0); $topic->setCachedReplyCount(0); $topic->setClosed(false); $topic->setDeleted(false); $topic->setSticky(false); $this->dispatcher->dispatch(ForumEvents::USER_TOPIC_CREATE_SUCCESS, new UserTopicEvent($this->request, $topic)); $this->postModel->savePost($post); $topic->setFirstPost($post); $topic->setLastPost($post); $this->topicModel->saveTopic($topic); $this->dispatcher->dispatch(ForumEvents::USER_TOPIC_CREATE_COMPLETE, new UserTopicEvent($this->request, $topic, $this->didAuthorSubscribe())); }