Skip to content

Commit 3a3bc6f

Browse files
authored
MDEE-1023: Add ability to collect entities payload for saas:resync --dry-run command (#480)
1 parent e475f2f commit 3a3bc6f

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

DataExporter/Model/Indexer/Config.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,4 +155,15 @@ public function isDryRun(): bool
155155
$configOptions = $this->configOptionsHandler->getConfigOptionsPool();
156156
return $configOptions->getFeedOption(self::EXPORTER_DRY_RUN) ?? false;
157157
}
158+
159+
/**
160+
* Check if submitted items should be included in dry run mode
161+
*
162+
* @return bool
163+
*/
164+
public function includeSubmittedInDryRun(): bool
165+
{
166+
$configOptions = $this->configOptionsHandler->getConfigOptionsPool();
167+
return $this->isDryRun() && $configOptions->getFeedOption(self::EXPORTER_CLEAN_UP_FEED) ?? false;
168+
}
158169
}

DataExporter/Model/Indexer/FeedIndexProcessorCreateUpdate.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
use Magento\DataExporter\Model\Batch\BatchGeneratorInterface;
2020
use Magento\DataExporter\Model\Batch\FeedSource\Generator as FeedSourceBatchGenerator;
21+
use Magento\DataExporter\Model\Indexer\Config as IndexerConfig;
2122
use Magento\DataExporter\Model\Logging\CommerceDataExportLoggerInterface;
2223
use Magento\DataExporter\Status\ExportStatusCodeProvider as ExportStatusCode;
2324
use Magento\Framework\App\ObjectManager;
@@ -47,6 +48,8 @@ class FeedIndexProcessorCreateUpdate implements FeedIndexProcessorInterface
4748
private BatchGeneratorInterface $batchGenerator;
4849
private IndexStateProviderFactory $indexStateProviderFactory;
4950

51+
private Config $indexerConfig;
52+
5053
/**
5154
* @param ResourceConnection $resourceConnection
5255
* @param ExportProcessor $exportProcessor
@@ -59,6 +62,7 @@ class FeedIndexProcessorCreateUpdate implements FeedIndexProcessorInterface
5962
* @param ProcessManagerFactory|null $processManagerFactory
6063
* @param BatchGeneratorInterface|null $batchGenerator
6164
* @param ?IndexStateProviderFactory $indexStateProviderFactory
65+
* @param ?Config $indexerConfig
6266
*
6367
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
6468
*/
@@ -73,7 +77,8 @@ public function __construct(
7377
?DeletedEntitiesProviderInterface $deletedEntitiesProvider = null,
7478
?ProcessManagerFactory $processManagerFactory = null,
7579
?BatchGeneratorInterface $batchGenerator = null,
76-
?IndexStateProviderFactory $indexStateProviderFactory = null
80+
?IndexStateProviderFactory $indexStateProviderFactory = null,
81+
?IndexerConfig $indexerConfig = null
7782
) {
7883
$this->resourceConnection = $resourceConnection;
7984
$this->exportProcessor = $exportProcessor;
@@ -90,6 +95,8 @@ public function __construct(
9095
ObjectManager::getInstance()->get(FeedSourceBatchGenerator::class);
9196
$this->indexStateProviderFactory = $indexStateProviderFactory ??
9297
ObjectManager::getInstance()->get(IndexStateProviderFactory::class);
98+
$this->indexerConfig = $indexerConfig
99+
?? ObjectManager::getInstance()->get(IndexerConfig::class);
93100
}
94101

95102
/**
@@ -355,7 +362,8 @@ private function isSendNeeded(string $oldFeedHash, string $newFeedHash, int $fee
355362
true
356363
)
357364
&& $feedStatus !== ExportStatusCode::FAILED_ITEM_ERROR
358-
);
365+
)
366+
|| $this->indexerConfig->includeSubmittedInDryRun();
359367
}
360368

361369
/**

0 commit comments

Comments
 (0)