/** * * @access protected * @param \CCDNForum\ForumBundle\Entity\Post $post */ protected function onSuccess(Post $post) { $post->setUnlockedDate(new \Datetime('now')); $post->setUnlockedBy($this->user); $this->dispatcher->dispatch(ForumEvents::MODERATOR_POST_UNLOCK_SUCCESS, new ModeratorPostEvent($this->request, $this->post)); $this->postModel->updatePost($post); $this->dispatcher->dispatch(ForumEvents::MODERATOR_POST_UNLOCK_COMPLETE, new ModeratorPostEvent($this->request, $post)); }
/** * * @access protected * @param \CCDNForum\ForumBundle\Entity\Post $post */ protected function updateRegistryStats(Post $post) { $user = $post->getCreatedBy(); if ($user) { $registry = $this->registryModel->findOrCreateOneRegistryForUser($user); $postCount = $this->postModel->countPostsForUserById($user->getId()); $registry->setCachedPostCount($postCount ? $postCount : 0); $this->registryModel->saveRegistry($registry); } }
/** * * @access protected * @param \CCDNForum\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 \CCDNForum\ForumBundle\Entity\Post $post */ protected function onSuccess(Post $post) { // get the current time, and compare to when the post was made. $now = new \DateTime(); $interval = $now->diff($post->getCreatedDate()); // if post is less than 15 minutes old, don't add that it was edited. if ($interval->format('%i') > 15) { $post->setEditedDate(new \DateTime()); $post->setEditedBy($this->user); } $this->dispatcher->dispatch(ForumEvents::USER_POST_EDIT_SUCCESS, new UserPostEvent($this->request, $this->post)); $this->postModel->updatePost($post); $this->dispatcher->dispatch(ForumEvents::USER_POST_EDIT_COMPLETE, new UserPostEvent($this->request, $this->post)); }
/** * * @access protected * @param \CCDNForum\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())); }
/** * * @access protected * @param \CCDNForum\ForumBundle\Entity\Post $post */ protected function onSuccess(Post $post) { $this->dispatcher->dispatch(ForumEvents::USER_POST_SOFT_DELETE_SUCCESS, new UserPostEvent($this->request, $this->post)); $this->postModel->softDelete($post, $this->user); $this->dispatcher->dispatch(ForumEvents::USER_POST_SOFT_DELETE_COMPLETE, new UserPostEvent($this->request, $post)); }