Skip to content

Commit 14c19f0

Browse files
authored
MDEE-1049: Submitted items will not be saved to DB if one of first items has an errors and another don't (#487)
* MDEE-1049: Submitted items will not be saved to DB if one of first items has an errors and another don't
1 parent 983e1a3 commit 14c19f0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

CatalogDataExporter/Test/Integration/ProductDataSerializerTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ public function testSecondFeedItemHasErrorInExportStatus(): void
9090
'feed_hash' => 'hash',
9191
'feed_id' => 'feed_id_1',
9292
"source_entity_id" => 1,
93+
'errors' => '',
9394
'operation' => IndexStateProvider::INSERT_OPERATION
9495
],
9596
[
@@ -120,6 +121,7 @@ public function testSecondFeedItemHasErrorInExportStatus(): void
120121
'feed_hash' => 'hash',
121122
'feed_id' => 'feed_id_3',
122123
"source_entity_id" => 3,
124+
'errors' => '',
123125
'operation' => IndexStateProvider::INSERT_OPERATION
124126
],
125127
];
@@ -263,9 +265,6 @@ private function prepareExpectedData(
263265
'source_entity_id' => $feed['productId']
264266
];
265267
$currentKey = array_key_last($expected);
266-
if (empty($expected[$currentKey]['errors'])) {
267-
unset($expected[$currentKey]['errors']);
268-
}
269268
}
270269
return $expected;
271270
}

DataExporter/Model/Indexer/DataSerializer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ private function serializeForImmediateExport(
142142
?? 0;
143143
$outputRow[FeedIndexMetadata::FEED_TABLE_FIELD_STATUS] = $status->getValue();
144144
$outputRow[FeedIndexMetadata::FEED_TABLE_FIELD_MODIFIED_AT] = $rowModifiedAt;
145+
$outputRow[FeedIndexMetadata::FEED_TABLE_FIELD_ERRORS] = '';
145146
if (!empty($exportFailedItems)) {
146147
$failedFeedItem = $exportFailedItems[$itemN] ?? null;
147148
// if _specific_ item failed mark only that item as failed, otherwise set status successful

0 commit comments

Comments
 (0)