public function canRestoreTopic(Topic $topic, Forum $forum = null) { if (!$topic->isDeleted()) { return false; } if (!$this->canShowTopic($topic, $forum) && !$this->securityContext->isGranted('ROLE_ADMIN')) { return false; } if (!$this->securityContext->isGranted('ROLE_MODERATOR')) { return false; } return true; }
/** * * @access public * @param \Map2u\ForumBundle\Entity\Topic $topic * @return \Map2u\ForumBundle\Manager\ManagerInterface */ public function reopen(Topic $topic) { $topic->setClosed(false); $topic->setClosedBy(null); $topic->setClosedDate(null); if ($topic->isDeleted()) { $topic->setDeleted(false); $topic->setDeletedBy(null); $topic->setDeletedDate(null); } $this->persist($topic)->flush(); return $this; }