NotSyncedDataProvider.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Sales\Model\ResourceModel\Provider;
  7. use Magento\Framework\ObjectManager\TMapFactory;
  8. /**
  9. * Implements NotSyncedDataProviderInterface as composite
  10. */
  11. class NotSyncedDataProvider implements NotSyncedDataProviderInterface
  12. {
  13. /**
  14. * @var NotSyncedDataProviderInterface[]
  15. */
  16. private $providers;
  17. /**
  18. * @param TMapFactory $tmapFactory
  19. * @param array $providers
  20. */
  21. public function __construct(
  22. TMapFactory $tmapFactory,
  23. array $providers = []
  24. ) {
  25. $this->providers = $tmapFactory->create(
  26. [
  27. 'array' => $providers,
  28. 'type' => NotSyncedDataProviderInterface::class
  29. ]
  30. );
  31. }
  32. /**
  33. * @inheritDoc
  34. */
  35. public function getIds($mainTableName, $gridTableName)
  36. {
  37. $result = [];
  38. foreach ($this->providers as $provider) {
  39. $result = array_merge($result, $provider->getIds($mainTableName, $gridTableName));
  40. }
  41. return array_unique($result);
  42. }
  43. }