Delete.php 1007 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace Dotdigitalgroup\Email\Model\Sync\Td;
  3. /**
  4. * Handle TD delete data for importer.
  5. */
  6. class Delete extends \Dotdigitalgroup\Email\Model\Sync\Contact\Delete
  7. {
  8. /**
  9. * Sync.
  10. *
  11. * @param mixed $collection
  12. *
  13. * @return null
  14. */
  15. public function sync($collection)
  16. {
  17. foreach ($collection as $item) {
  18. $result = true;
  19. $websiteId = $item->getWebsiteId();
  20. if ($this->helper->isEnabled($websiteId)) {
  21. $this->client = $this->helper->getWebsiteApiClient($websiteId);
  22. $importData = $this->serializer->unserialize($item->getImportData());
  23. if ($this->client) {
  24. $key = $importData[0];
  25. $collectionName = $item->getImportType();
  26. $this->client->deleteContactsTransactionalData($key, $collectionName);
  27. $this->_handleSingleItemAfterSync($item, $result);
  28. }
  29. }
  30. }
  31. }
  32. }