Skip to content

Commit e35fca3

Browse files
committed
MAGETWO-89337: "My Requisition Lists" option is absent in header menu.
1 parent f6198ad commit e35fca3

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

app/code/Magento/Sales/CustomerData/LastOrderedItems.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@
77

88
use Magento\Customer\CustomerData\SectionSourceInterface;
99
use Magento\Catalog\Api\ProductRepositoryInterface;
10+
use Magento\Framework\Exception\NoSuchEntityException;
1011
use Psr\Log\LoggerInterface;
1112
use Magento\Framework\App\ObjectManager;
1213

1314
/**
1415
* Returns information for "Recently Ordered" widget.
1516
* It contains list of 5 salable products from the last placed order.
1617
* Qty of products to display is limited by LastOrderedItems::SIDEBAR_ORDER_LIMIT constant.
18+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1719
*/
1820
class LastOrderedItems implements SectionSourceInterface
1921
{
@@ -74,6 +76,7 @@ class LastOrderedItems implements SectionSourceInterface
7476
* @param \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry
7577
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
7678
* @param ProductRepositoryInterface $productRepository
79+
* @param LoggerInterface|null $logger
7780
*/
7881
public function __construct(
7982
\Magento\Sales\Model\ResourceModel\Order\CollectionFactory $orderCollectionFactory,
@@ -90,7 +93,7 @@ public function __construct(
9093
$this->stockRegistry = $stockRegistry;
9194
$this->_storeManager = $storeManager;
9295
$this->productRepository = $productRepository;
93-
$this->logger = $logger ?: ObjectManager::getInstance()->get(LoggerInterface::class);
96+
$this->logger = $logger ?? ObjectManager::getInstance()->get(LoggerInterface::class);
9497
}
9598

9699
/**
@@ -133,9 +136,9 @@ protected function getItems()
133136
false,
134137
$this->_storeManager->getStore()->getId()
135138
);
136-
}catch (\Magento\Framework\Exception\NoSuchEntityException $e){
137-
$this->logger->critical($e);
138-
break;
139+
} catch (NoSuchEntityException $noEntityException) {
140+
$this->logger->critical($noEntityException);
141+
continue;
139142
}
140143
if (isset($product) && in_array($website, $product->getWebsiteIds())) {
141144
$url = $product->isVisibleInSiteVisibility() ? $product->getProductUrl() : null;
@@ -166,7 +169,7 @@ protected function isItemAvailableForReorder(\Magento\Sales\Model\Order\Item $or
166169
$orderItem->getStore()->getWebsiteId()
167170
);
168171
return $stockItem->getIsInStock();
169-
} catch (\Magento\Framework\Exception\NoSuchEntityException $noEntityException) {
172+
} catch (NoSuchEntityException $noEntityException) {
170173
return false;
171174
}
172175
}

0 commit comments

Comments
 (0)