/**
  *
  * @access public
  * @param  \CCDNForum\ForumBundle\Entity\Subscription      $subscription
  * @return \CCDNForum\ForumBundle\Manager\ManagerInterface
  */
 public function markAsUnread(Subscription $subscription)
 {
     $subscription->setRead(false);
     $this->persist($subscription)->flush();
     return $this;
 }
Ejemplo n.º 2
0
 public function canUnsubscribeFromTopic(Topic $topic, Forum $forum = null, Subscription $subscription = null)
 {
     if (!$this->securityContext->isGranted('ROLE_USER')) {
         return false;
     }
     if (!$this->canShowTopic($topic, $forum)) {
         return false;
     }
     if ($subscription) {
         if ($subscription->getTopic()) {
             if ($subscription->getTopic()->getId() != $topic->getId()) {
                 return false;
             }
         }
         if (!$subscription->isSubscribed()) {
             return false;
         }
     } else {
         return false;
     }
     return true;
 }