Skip to content

Commit

Permalink
#1759 Additional support for empty arrays and invalid Entity IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
lbajsarowicz committed Aug 4, 2023
1 parent 81b8ec3 commit 456fb13
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Ui/Component/Listing/Column/Monkey.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ public function prepareDataSource(array $dataSource)
$sync = $item['mailchimp_sent'];
$error = $item['mailchimp_sync_error'];

$order = $this->_orderFactory->create()->loadByIncrementId($orderId);
$order = $orderMap[$orderId]
?? $this->_orderFactory->create()->loadByIncrementId($orderId); // Backwards Compatibility
$menu = false;
$params = ['_secure' => $this->_requestInterfase->isSecure()];
$storeId = $order->getStoreId();
Expand Down Expand Up @@ -239,7 +240,7 @@ private function getOrderIncrementIds(array $dataSource): array
return [];
}

return array_column($dataSource['data']['items'], 'increment_id');
return array_filter(array_unique(array_column($dataSource['data']['items'], 'increment_id')));
}

/**
Expand All @@ -248,6 +249,10 @@ private function getOrderIncrementIds(array $dataSource): array
*/
private function getOrderDataForIncrementIds(array $incrementIds): array
{
if (empty($incrementIds)) {
return [];
}

$orderCollection = $this->orderCollectionFactory->create();
$orderCollection->getSelect()->columns(['entity_id', 'increment_id', 'store_id']);
$orderCollection->addAttributeToFilter(
Expand Down

0 comments on commit 456fb13

Please sign in to comment.