Skip to content

Commit 2f729ac

Browse files
authored
ENGCOM-7605: Remove redundant argument in method useProductItem #28466
2 parents 40ad755 + 9ed01a9 commit 2f729ac

File tree

5 files changed

+18
-28
lines changed

5 files changed

+18
-28
lines changed

app/code/Magento/Catalog/Block/Product/Compare/ListCompare.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public function getItems()
149149
$this->_compareProduct->setAllowUsedFlat(false);
150150

151151
$this->_items = $this->_itemCollectionFactory->create();
152-
$this->_items->useProductItem(true)->setStoreId($this->_storeManager->getStore()->getId());
152+
$this->_items->useProductItem()->setStoreId($this->_storeManager->getStore()->getId());
153153

154154
if ($this->httpContext->getValue(Context::CONTEXT_AUTH)) {
155155
$this->_items->setCustomerId($this->currentCustomer->getCustomerId());

app/code/Magento/Catalog/Helper/Product/Compare.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ public function getItemCollection()
279279
// cannot be placed in constructor because of the cyclic dependency which cannot be fixed with proxy class
280280
// collection uses this helper in constructor when calling isEnabledFlat() method
281281
$this->_itemCollection = $this->_itemCollectionFactory->create();
282-
$this->_itemCollection->useProductItem(true)->setStoreId($this->_storeManager->getStore()->getId());
282+
$this->_itemCollection->useProductItem()->setStoreId($this->_storeManager->getStore()->getId());
283283

284284
if ($this->_customerSession->isLoggedIn()) {
285285
$this->_itemCollection->setCustomerId($this->_customerSession->getCustomerId());
@@ -313,7 +313,7 @@ public function calculate($logout = false)
313313
{
314314
/** @var $collection Collection */
315315
$collection = $this->_itemCollectionFactory->create()
316-
->useProductItem(true);
316+
->useProductItem();
317317
if (!$logout && $this->_customerSession->isLoggedIn()) {
318318
$collection->setCustomerId($this->_customerSession->getCustomerId());
319319
} elseif ($this->_customerId) {

app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Compared.php

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,15 @@ public function getItemCollection()
4646
$collection = $this->getData('item_collection');
4747
if ($collection === null) {
4848
if ($collection = $this->getCreateOrderModel()->getCustomerCompareList()) {
49-
$collection = $collection->getItemCollection()->useProductItem(
50-
true
51-
)->setStoreId(
52-
$this->getQuote()->getStoreId()
53-
)->addStoreFilter(
54-
$this->getQuote()->getStoreId()
55-
)->setCustomerId(
56-
$this->getCustomerId()
57-
)->addAttributeToSelect(
58-
'name'
59-
)->addAttributeToSelect(
60-
'price'
61-
)->addAttributeToSelect(
62-
'image'
63-
)->addAttributeToSelect(
64-
'status'
65-
)->load();
49+
$collection = $collection->getItemCollection()
50+
->useProductItem()
51+
->setStoreId($this->getQuote()->getStoreId())
52+
->addStoreFilter($this->getQuote()->getStoreId())
53+
->setCustomerId($this->getCustomerId())
54+
->addAttributeToSelect('name')
55+
->addAttributeToSelect('price')->addAttributeToSelect('image')
56+
->addAttributeToSelect('status')
57+
->load();
6658
}
6759
$this->setData('item_collection', $collection);
6860
}

app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Pcompared.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,11 @@ public function getItemCollection()
8989
// get products to skip
9090
$skipProducts = [];
9191
if ($collection = $this->getCreateOrderModel()->getCustomerCompareList()) {
92-
$collection = $collection->getItemCollection()->useProductItem(
93-
true
94-
)->setStoreId(
95-
$this->getStoreId()
96-
)->setCustomerId(
97-
$this->getCustomerId()
98-
)->load();
92+
$collection = $collection->getItemCollection()
93+
->useProductItem()
94+
->setStoreId($this->getStoreId())
95+
->setCustomerId($this->getCustomerId())
96+
->load();
9997
foreach ($collection as $_item) {
10098
$skipProducts[] = $_item->getProductId();
10199
}

dev/tests/integration/testsuite/Magento/Catalog/Controller/Product/CompareTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ protected function _assertCompareListEquals(array $expectedProductIds)
412412
$compareItems = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
413413
\Magento\Catalog\Model\ResourceModel\Product\Compare\Item\Collection::class
414414
);
415-
$compareItems->useProductItem(true);
415+
$compareItems->useProductItem();
416416
// important
417417
$compareItems->setVisitorId(
418418
\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(

0 commit comments

Comments
 (0)