/** * {@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(); }
/** * {@inheritdoc} */ public function notify(ActionInterface $action, EntryCollection $entryCollection) { $i = 0; foreach ($entryCollection as $context => $entries) { foreach ($entries as $entry) { $i++; $this->timelineManager->createAndPersist($action, $entry->getSubject(), $context, 'notification'); } } if ($i > 0) { $this->timelineManager->flush(); } }