Skip to content

Commit 806f7a2

Browse files
committed
PHPStan Baseline: Mage_Wishlist
1 parent ae99330 commit 806f7a2

File tree

14 files changed

+92
-54
lines changed

14 files changed

+92
-54
lines changed

app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Wishlist.php

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,25 @@ public function __construct()
3535
#[\Override]
3636
protected function _prepareCollection()
3737
{
38-
$collection = Mage::getModel('wishlist/item')->getCollection()
39-
->addCustomerIdFilter(Mage::registry('current_customer')->getId())
40-
->addDaysInWishlist(true)
41-
->addStoreData()
42-
->setInStockFilter(true);
38+
$customer = Mage::registry('current_customer');
39+
$storeIds = Mage::app()->getWebsite($this->getWebsiteId())->getStoreIds();
40+
41+
$wishlist = Mage::getModel('wishlist/wishlist')
42+
->setSharedStoreIds($storeIds)
43+
->loadByCustomer($customer, true);
44+
45+
if ($wishlist) {
46+
$collection = $wishlist->getItemsCollection();
47+
} else {
48+
$collection = new Varien_Data_Collection();
49+
}
50+
51+
$collection
52+
->setWebsiteId($customer->getWebsiteId())
53+
->setCustomerGroupId($customer->getGroupId())
54+
->resetSortOrder()
55+
->setDaysInWishlist(true)
56+
->addStoreData();
4357

4458
$this->setCollection($collection);
4559

app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Wishlist.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ protected function _prepareCollection()
9090
->setWebsiteId($this->_getCustomer()->getWebsiteId())
9191
->setCustomerGroupId($this->_getCustomer()->getGroupId())
9292
->resetSortOrder()
93-
->addDaysInWishlist()
93+
->setDaysInWishlist(true)
9494
->addStoreData();
9595

9696
$this->setCollection($collection);

app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Sidebar/Wishlist.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function getItemCollection()
5252
if (is_null($collection)) {
5353
$collection = $this->getCreateOrderModel()->getCustomerWishlist(true);
5454
if ($collection) {
55-
$collection = $collection->getItemCollection()->load();
55+
$collection = $collection->getItemsCollection()->load();
5656
}
5757
$this->setData('item_collection', $collection);
5858
}

app/code/core/Mage/Adminhtml/controllers/Customer/Wishlist/Product/Composite/WishlistController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Mage_Adminhtml_Customer_Wishlist_Product_Composite_WishlistController exte
3838
/**
3939
* Wishlist item we're working with
4040
*
41-
* @var Mage_Wishlist_Model_Wishlist
41+
* @var Mage_Wishlist_Model_Item
4242
*/
4343
protected $_wishlistItem = null;
4444

app/code/core/Mage/Customer/Block/Account/Dashboard/Sidebar.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function getWishlist()
5656
if (!$this->_wishlist) {
5757
$this->_wishlist = Mage::getModel('wishlist/wishlist')
5858
->loadByCustomer(Mage::getSingleton('customer/session')->getCustomer());
59-
$this->_wishlist->getItemCollection()
59+
$this->_wishlist->getItemsCollection()
6060
->addAttributeToSelect('name')
6161
->addAttributeToSelect('price')
6262
->addAttributeToSelect('small_image')
@@ -67,7 +67,7 @@ public function getWishlist()
6767
->load();
6868
}
6969

70-
return $this->_wishlist->getItemCollection();
70+
return $this->_wishlist->getItemsCollection();
7171
}
7272

7373
/**

app/code/core/Mage/Wishlist/Block/Abstract.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ protected function _prepareCollection($collection)
104104
*/
105105
protected function _createWishlistItemCollection()
106106
{
107-
return $this->_getWishlist()->getItemCollection();
107+
return $this->_getWishlist()->getItemsCollection();
108108
}
109109

110110
/**

app/code/core/Mage/Wishlist/Block/Links.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function getCacheTags()
109109
$helper = $this->helper('wishlist');
110110
$wishlist = $helper->getWishlist();
111111
$this->addModelTags($wishlist);
112-
foreach ($wishlist->getItemCollection() as $item) {
112+
foreach ($wishlist->getItemsCollection() as $item) {
113113
$this->addModelTags($item);
114114
}
115115
return parent::getCacheTags();

app/code/core/Mage/Wishlist/Controller/Abstract.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function allcartAction()
7474
$hasOptions = [];
7575

7676
$cart = Mage::getSingleton('checkout/cart');
77-
$collection = $wishlist->getItemCollection()
77+
$collection = $wishlist->getItemsCollection()
7878
->setVisibilityFilter();
7979

8080
$qtysString = $this->getRequest()->getParam('qty');

app/code/core/Mage/Wishlist/Helper/Data.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public function getItemCollection()
186186
*/
187187
protected function _createWishlistItemCollection()
188188
{
189-
return $this->getWishlist()->getItemCollection();
189+
return $this->getWishlist()->getItemsCollection();
190190
}
191191

192192
/**

app/code/core/Mage/Wishlist/Model/Observer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ public function processAddToCart($observer)
104104
return;
105105
}
106106

107-
$wishlist->getItemCollection()->load();
107+
$wishlist->getItemsCollection()->load();
108108

109-
foreach ($wishlist->getItemCollection() as $wishlistItem) {
109+
foreach ($wishlist->getItemsCollection() as $wishlistItem) {
110110
if ($wishlistItem->getId() == $wishlistId) {
111111
$wishlistItem->delete();
112112
}

0 commit comments

Comments
 (0)