Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function deploy(ActionInterface $action, ActionManagerInterface $actionManager)
 {
     if ($action->getStatusWanted() !== ActionInterface::STATUS_PUBLISHED) {
         return;
     }
     $this->entryCollection->setActionManager($actionManager);
     $results = $this->processSpreads($action);
     $results->loadUnawareEntries();
     $i = 1;
     foreach ($results as $context => $entries) {
         foreach ($entries as $entry) {
             $this->timelineManager->createAndPersist($action, $entry->getSubject(), $context, TimelineInterface::TYPE_TIMELINE);
             if ($i % $this->batchSize == 0) {
                 $this->timelineManager->flush();
             }
             $i++;
         }
     }
     if ($i > 1) {
         $this->timelineManager->flush();
     }
     foreach ($this->notifiers as $notifier) {
         $notifier->notify($action, $results);
     }
     $action->setStatusCurrent(ActionInterface::STATUS_PUBLISHED);
     $action->setStatusWanted(ActionInterface::STATUS_FROZEN);
     $actionManager->updateAction($action);
     $this->entryCollection->clear();
 }
 /**
  * markAllAsRead
  *
  * @param ComponentInterface $subject subject
  * @param string             $context The context
  */
 public function markAllAsRead(ComponentInterface $subject, $context = "GLOBAL")
 {
     $options = array('context' => $context, 'type' => 'notification');
     $this->timelineManager->removeAll($subject, $options);
     $this->timelineManager->flush();
 }