ExportDataHandlerNotification.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Analytics\Model;
  7. /**
  8. * Class which add notification behaviour to classes that handling of a new data collection for MBI.
  9. */
  10. class ExportDataHandlerNotification implements ExportDataHandlerInterface
  11. {
  12. /**
  13. * @var ExportDataHandler
  14. */
  15. private $exportDataHandler;
  16. /**
  17. * @var Connector
  18. */
  19. private $analyticsConnector;
  20. /**
  21. * @param ExportDataHandlerInterface $exportDataHandler
  22. * @param Connector $connector
  23. */
  24. public function __construct(ExportDataHandler $exportDataHandler, Connector $connector)
  25. {
  26. $this->exportDataHandler = $exportDataHandler;
  27. $this->analyticsConnector = $connector;
  28. }
  29. /**
  30. * {@inheritdoc}
  31. * Execute notification command.
  32. *
  33. * @return bool
  34. */
  35. public function prepareExportData()
  36. {
  37. $result = $this->exportDataHandler->prepareExportData();
  38. $this->analyticsConnector->execute('notifyDataChanged');
  39. return $result;
  40. }
  41. }