/** * * @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 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)); }