Example #1
0
 /**
  *
  * @access public
  * @param  \Map2u\ForumBundle\Entity\Post                  $post
  * @param  \Symfony\Component\Security\Core\User\UserInterface $user
  * @return \Map2u\ForumBundle\Manager\ManagerInterface
  */
 public function softDelete(Post $post, UserInterface $user)
 {
     // Don't overwite previous users accountability.
     if (!$post->getDeletedBy() && !$post->getDeletedDate()) {
         $post->setDeleted(true);
         $post->setDeletedBy($user);
         $post->setDeletedDate(new \DateTime());
         // update the record
         $this->persist($post)->flush();
     }
     return $this;
 }