/**
  * {@inheritdoc}
  */
 public function write(array $items)
 {
     /** @var ExtendedMergeVar $item */
     $item = reset($items);
     $staticSegment = $item->getStaticSegment();
     $channel = $staticSegment->getChannel();
     $this->transport->init($channel->getTransport());
     $items = new ArrayCollection($items);
     $itemsToWrite = [];
     try {
         $addedItems = $this->add($items);
         $removedItems = $this->remove($items);
         if ($addedItems) {
             $this->logger->info(sprintf('Extended merge vars: [%s] added', count($addedItems)));
         }
         if ($removedItems) {
             $this->logger->info(sprintf('Extended merge vars: [%s] removed', count($addedItems)));
         }
         $itemsToWrite = array_merge($itemsToWrite, $addedItems, $removedItems);
     } catch (\Exception $e) {
         $this->logger->error($e->getMessage());
         $this->stepExecution->addFailureException($e);
     }
     parent::write($itemsToWrite);
 }
 /**
  * {@inheritdoc}
  */
 public function write(array $items)
 {
     $itemsToWrite = [];
     /** @var Member $item */
     $item = reset($items);
     $this->transport->init($item->getChannel()->getTransport());
     $subscribersList = $item->getSubscribersList();
     $itemsToSave = $this->batchSubscribe($subscribersList, $items);
     if ($itemsToSave) {
         $itemsToWrite = array_merge($itemsToWrite, $itemsToSave);
     }
     parent::write($itemsToWrite);
 }
 /**
  * {@inheritdoc}
  */
 public function write(array $items)
 {
     /** @var ExtendedMergeVar $item */
     $item = reset($items);
     $staticSegment = $item->getStaticSegment();
     $channel = $staticSegment->getChannel();
     $this->transport->init($channel->getTransport());
     $items = new ArrayCollection($items);
     $itemsToWrite = [];
     $addedItems = $this->set($items);
     if ($addedItems) {
         $this->logger->info(sprintf('Set Member Extended Merge Vars: [%s] added', count($addedItems)));
     }
     $itemsToWrite = array_merge($itemsToWrite, $addedItems);
     parent::write($itemsToWrite);
 }
 /**
  * {@inheritdoc}
  */
 public function write(array $items)
 {
     /** @var StaticSegmentMember $item */
     $item = reset($items);
     $staticSegment = $item->getStaticSegment();
     $channel = $staticSegment->getChannel();
     $this->transport->init($channel->getTransport());
     $this->addStaticListSegment($staticSegment);
     $itemsToWrite = [$staticSegment];
     $addedItems = $this->handleMembersUpdate($staticSegment, StaticSegmentMember::STATE_ADD, 'addStaticSegmentMembers', StaticSegmentMember::STATE_SYNCED);
     $removedItems = $this->handleMembersUpdate($staticSegment, StaticSegmentMember::STATE_REMOVE, 'deleteStaticSegmentMembers', StaticSegmentMember::STATE_DROP);
     $unsubscribedItems = $this->handleMembersUpdate($staticSegment, StaticSegmentMember::STATE_UNSUBSCRIBE, 'batchUnsubscribe', StaticSegmentMember::STATE_DROP);
     $unsubscribedDeletedItems = $this->handleMembersUpdate($staticSegment, StaticSegmentMember::STATE_UNSUBSCRIBE_DELETE, 'batchUnsubscribe', StaticSegmentMember::STATE_UNSUBSCRIBE_DELETE, true);
     $itemsToWrite = array_merge($itemsToWrite, $addedItems, $removedItems, $unsubscribedItems, $unsubscribedDeletedItems);
     parent::write($itemsToWrite);
 }