From 43529306f117997181219552390f9dba027abc41 Mon Sep 17 00:00:00 2001 From: sv3n Date: Sat, 27 Jun 2020 02:06:31 +0200 Subject: [PATCH] Mage_Wishlist - DOC block update (#742) - doc blocks added/fixed - PSR2 fixes (whitespaces, linebreaks, ...) Co-authored-by: Tymoteusz Motylewski --- .../core/Mage/Wishlist/Block/Abstract.php | 4 +- .../Mage/Wishlist/Block/Customer/Sharing.php | 9 +-- .../Mage/Wishlist/Block/Customer/Sidebar.php | 6 +- .../Mage/Wishlist/Block/Customer/Wishlist.php | 4 +- .../Customer/Wishlist/Item/Column/Comment.php | 3 +- .../Block/Customer/Wishlist/Item/Options.php | 5 +- .../Block/Customer/Wishlist/Items.php | 2 +- .../Mage/Wishlist/Block/Item/Configure.php | 2 +- app/code/core/Mage/Wishlist/Block/Links.php | 8 +- .../Mage/Wishlist/Block/Render/Item/Price.php | 4 + .../Mage/Wishlist/Block/Share/Email/Rss.php | 3 +- .../Mage/Wishlist/Controller/Abstract.php | 10 +-- app/code/core/Mage/Wishlist/Helper/Data.php | 2 +- .../Wishlist/Model/Config/Source/Summary.php | 3 + app/code/core/Mage/Wishlist/Model/Item.php | 77 +++++++++++-------- .../core/Mage/Wishlist/Model/Item/Option.php | 12 ++- .../core/Mage/Wishlist/Model/Observer.php | 16 ++-- .../Model/Resource/Item/Collection.php | 10 ++- .../Model/Resource/Item/Option/Collection.php | 6 +- .../Model/Resource/Product/Collection.php | 12 +-- .../Mage/Wishlist/Model/Resource/Wishlist.php | 4 +- .../Model/Resource/Wishlist/Collection.php | 3 +- app/code/core/Mage/Wishlist/Model/Session.php | 5 +- .../core/Mage/Wishlist/Model/Wishlist.php | 29 +++---- .../Wishlist/controllers/IndexController.php | 41 +++++----- .../Wishlist/controllers/SharedController.php | 4 +- .../sql/wishlist_setup/install-1.6.0.0.php | 57 ++++++++++---- .../wishlist_setup/mysql4-install-0.7.0.php | 2 +- .../mysql4-upgrade-0.7.0-0.7.1.php | 2 +- .../mysql4-upgrade-0.7.1-0.7.2.php | 2 +- .../mysql4-upgrade-0.7.2-0.7.4.php | 2 +- .../mysql4-upgrade-0.7.4-0.7.5.php | 57 +++++++++----- .../mysql4-upgrade-0.7.6-0.7.7.php | 2 +- .../mysql4-upgrade-0.7.7-0.7.8.php | 2 +- .../mysql4-upgrade-0.7.8-0.7.9.php | 2 +- .../mysql4-upgrade-1.5.9.9-1.6.0.0.php | 5 +- 36 files changed, 247 insertions(+), 170 deletions(-) diff --git a/app/code/core/Mage/Wishlist/Block/Abstract.php b/app/code/core/Mage/Wishlist/Block/Abstract.php index f996884981c..3685b0f64f5 100644 --- a/app/code/core/Mage/Wishlist/Block/Abstract.php +++ b/app/code/core/Mage/Wishlist/Block/Abstract.php @@ -106,7 +106,7 @@ protected function _getWishlist() * Prepare additional conditions to collection * * @param Mage_Wishlist_Model_Resource_Item_Collection $collection - * @return Mage_Wishlist_Block_Customer_Wishlist + * @return $this */ protected function _prepareCollection($collection) { @@ -151,8 +151,8 @@ public function getWishlistInstance() /** * Back compatibility retrieve wishlist product items * + * @return Mage_Wishlist_Model_Resource_Item_Collection * @deprecated after 1.4.2.0 - * @return Mage_Wishlist_Model_Mysql4_Item_Collection */ public function getWishlist() { diff --git a/app/code/core/Mage/Wishlist/Block/Customer/Sharing.php b/app/code/core/Mage/Wishlist/Block/Customer/Sharing.php index 231a321e159..cb252b561ed 100644 --- a/app/code/core/Mage/Wishlist/Block/Customer/Sharing.php +++ b/app/code/core/Mage/Wishlist/Block/Customer/Sharing.php @@ -37,14 +37,14 @@ class Mage_Wishlist_Block_Customer_Sharing extends Mage_Core_Block_Template /** * Entered Data cache * - * @param array + * @var array */ - protected $_enteredData = null; + protected $_enteredData = null; /** * Prepare Global Layout * - * @return $this + * @return void */ protected function _prepareLayout() { @@ -79,8 +79,7 @@ public function getEnteredData($key) if (!$this->_enteredData || !isset($this->_enteredData[$key])) { return null; - } - else { + } else { return $this->escapeHtml($this->_enteredData[$key]); } } diff --git a/app/code/core/Mage/Wishlist/Block/Customer/Sidebar.php b/app/code/core/Mage/Wishlist/Block/Customer/Sidebar.php index a2a3a9bd9f9..3b9aa23a9b8 100644 --- a/app/code/core/Mage/Wishlist/Block/Customer/Sidebar.php +++ b/app/code/core/Mage/Wishlist/Block/Customer/Sidebar.php @@ -47,8 +47,8 @@ public function getTitle() /** * Add sidebar conditions to collection * - * @param Mage_Wishlist_Model_Resource_Item_Collection $collection - * @return Mage_Wishlist_Block_Customer_Wishlist + * @param Mage_Wishlist_Model_Resource_Item_Collection $collection + * @return $this */ protected function _prepareCollection($collection) { @@ -157,6 +157,4 @@ public function getCacheTags() } return parent::getCacheTags(); } - - } diff --git a/app/code/core/Mage/Wishlist/Block/Customer/Wishlist.php b/app/code/core/Mage/Wishlist/Block/Customer/Wishlist.php index a901acaafdf..14f8cf42b5a 100644 --- a/app/code/core/Mage/Wishlist/Block/Customer/Wishlist.php +++ b/app/code/core/Mage/Wishlist/Block/Customer/Wishlist.php @@ -54,7 +54,7 @@ protected function _prepareCollection($collection) /** * Preparing global layout * - * @return $this + * @return void */ protected function _prepareLayout() { @@ -99,7 +99,7 @@ public function getOptionsRenderCfgs() return $this->_optionsCfg; } - /* + /** * Adds config for rendering product type options * * @deprecated after 1.6.2.0 diff --git a/app/code/core/Mage/Wishlist/Block/Customer/Wishlist/Item/Column/Comment.php b/app/code/core/Mage/Wishlist/Block/Customer/Wishlist/Item/Column/Comment.php index e4cbcd91931..7f603f4d0fa 100644 --- a/app/code/core/Mage/Wishlist/Block/Customer/Wishlist/Item/Column/Comment.php +++ b/app/code/core/Mage/Wishlist/Block/Customer/Wishlist/Item/Column/Comment.php @@ -31,8 +31,7 @@ * @package Mage_Wishlist * @author Magento Core Team */ -class Mage_Wishlist_Block_Customer_Wishlist_Item_Column_Comment - extends Mage_Wishlist_Block_Customer_Wishlist_Item_Column +class Mage_Wishlist_Block_Customer_Wishlist_Item_Column_Comment extends Mage_Wishlist_Block_Customer_Wishlist_Item_Column { /** * Retrieve column javascript code diff --git a/app/code/core/Mage/Wishlist/Block/Customer/Wishlist/Item/Options.php b/app/code/core/Mage/Wishlist/Block/Customer/Wishlist/Item/Options.php index 425e290a543..7e50e567f36 100644 --- a/app/code/core/Mage/Wishlist/Block/Customer/Wishlist/Item/Options.php +++ b/app/code/core/Mage/Wishlist/Block/Customer/Wishlist/Item/Options.php @@ -30,6 +30,9 @@ * @category Mage * @package Mage_Wishlist * @author Magento Core Team + * + * @method Mage_Wishlist_Model_Item getItem() + * @method $this setOptionList(array $value) */ class Mage_Wishlist_Block_Customer_Wishlist_Item_Options extends Mage_Wishlist_Block_Abstract { @@ -52,7 +55,7 @@ public function __construct() Mage::dispatchEvent('product_option_renderer_init', array('block' => $this)); } - /* + /** * Adds config for rendering product type options * * @param string $productType diff --git a/app/code/core/Mage/Wishlist/Block/Customer/Wishlist/Items.php b/app/code/core/Mage/Wishlist/Block/Customer/Wishlist/Items.php index a4ca989d8f5..3e8a31dfc30 100644 --- a/app/code/core/Mage/Wishlist/Block/Customer/Wishlist/Items.php +++ b/app/code/core/Mage/Wishlist/Block/Customer/Wishlist/Items.php @@ -43,7 +43,7 @@ public function getColumns() $columns = array(); foreach ($this->getSortedChildren() as $code) { $child = $this->getChild($code); - if ($child->isEnabled()){ + if ($child->isEnabled()) { $columns[] = $child; } } diff --git a/app/code/core/Mage/Wishlist/Block/Item/Configure.php b/app/code/core/Mage/Wishlist/Block/Item/Configure.php index fe2cd241841..87ed756e539 100644 --- a/app/code/core/Mage/Wishlist/Block/Item/Configure.php +++ b/app/code/core/Mage/Wishlist/Block/Item/Configure.php @@ -57,7 +57,7 @@ protected function getWishlistItem() /** * Configure product view blocks * - * @return $this + * @inheritDoc */ protected function _prepareLayout() { diff --git a/app/code/core/Mage/Wishlist/Block/Links.php b/app/code/core/Mage/Wishlist/Block/Links.php index 10f6aa3c19b..70bb1382062 100644 --- a/app/code/core/Mage/Wishlist/Block/Links.php +++ b/app/code/core/Mage/Wishlist/Block/Links.php @@ -88,7 +88,7 @@ protected function _createLabel($count) { if ($count > 1) { return $this->__('My Wishlist (%d items)', $count); - } else if ($count == 1) { + } elseif ($count == 1) { return $this->__('My Wishlist (%d item)', $count); } else { return $this->__('My Wishlist'); @@ -96,10 +96,10 @@ protected function _createLabel($count) } /** - * @deprecated after 1.4.2.0 + * @return Mage_Wishlist_Block_Links * @see Mage_Wishlist_Block_Links::__construct * - * @return array + * @deprecated after 1.4.2.0 */ public function addWishlistLink() { @@ -113,7 +113,7 @@ public function addWishlistLink() */ public function getCacheTags() { - /** @var $wishlist Mage_Wishlist_Model_Wishlist */ + /** @var Mage_Wishlist_Model_Wishlist $wishlist */ $wishlist = $this->helper('wishlist')->getWishlist(); $this->addModelTags($wishlist); foreach ($wishlist->getItemCollection() as $item) { diff --git a/app/code/core/Mage/Wishlist/Block/Render/Item/Price.php b/app/code/core/Mage/Wishlist/Block/Render/Item/Price.php index b4feda03450..e40c3d07ecc 100644 --- a/app/code/core/Mage/Wishlist/Block/Render/Item/Price.php +++ b/app/code/core/Mage/Wishlist/Block/Render/Item/Price.php @@ -30,6 +30,10 @@ * @category Mage * @package Mage_Wishlist * @author Magento Core Team + * + * @method Mage_Catalog_Model_Product getProduct() + * @method string getDisplayMinimalPrice() + * @method string getIdSuffix() */ class Mage_Wishlist_Block_Render_Item_Price extends Mage_Core_Block_Template { diff --git a/app/code/core/Mage/Wishlist/Block/Share/Email/Rss.php b/app/code/core/Mage/Wishlist/Block/Share/Email/Rss.php index 3f6f3fe73cb..2d7432d813d 100644 --- a/app/code/core/Mage/Wishlist/Block/Share/Email/Rss.php +++ b/app/code/core/Mage/Wishlist/Block/Share/Email/Rss.php @@ -24,13 +24,14 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Wishlist RSS URL to Email Block * * @category Mage * @package Mage_Wishlist * @author Magento Core Team + * + * @method $this setWishlistId(int $value) */ class Mage_Wishlist_Block_Share_Email_Rss extends Mage_Core_Block_Template { diff --git a/app/code/core/Mage/Wishlist/Controller/Abstract.php b/app/code/core/Mage/Wishlist/Controller/Abstract.php index 7033aac1b86..542c655f8e1 100644 --- a/app/code/core/Mage/Wishlist/Controller/Abstract.php +++ b/app/code/core/Mage/Wishlist/Controller/Abstract.php @@ -105,8 +105,8 @@ public function allcartAction() $qtys = array_filter(json_decode($qtysString), 'strlen'); } + /** @var Mage_Wishlist_Model_Item $item */ foreach ($collection as $item) { - /** @var Mage_Wishlist_Model_Item */ try { $disableAddToCart = $item->getProduct()->getDisableAddToCart(); $item->unsProduct(); @@ -123,11 +123,10 @@ public function allcartAction() if ($item->addToCart($cart, $isOwner)) { $addedItems[] = $item->getProduct(); } - } catch (Mage_Core_Exception $e) { if ($e->getCode() == Mage_Wishlist_Model_Item::EXCEPTION_CODE_NOT_SALABLE) { $notSalable[] = $item; - } else if ($e->getCode() == Mage_Wishlist_Model_Item::EXCEPTION_CODE_HAS_REQUIRED_OPTIONS) { + } elseif ($e->getCode() == Mage_Wishlist_Model_Item::EXCEPTION_CODE_HAS_REQUIRED_OPTIONS) { $hasOptions[] = $item; } else { $messages[] = $this->__('%s for "%s".', trim($e->getMessage(), '.'), $item->getProduct()->getName()); @@ -150,7 +149,7 @@ public function allcartAction() } if (Mage::helper('checkout/cart')->getShouldRedirectToCart()) { $redirectUrl = Mage::helper('checkout/cart')->getCartUrl(); - } else if ($this->_getRefererUrl()) { + } elseif ($this->_getRefererUrl()) { $redirectUrl = $this->_getRefererUrl(); } else { $redirectUrl = $indexUrl; @@ -193,8 +192,7 @@ public function allcartAction() // save wishlist model for setting date of last update try { $wishlist->save(); - } - catch (Exception $e) { + } catch (Exception $e) { Mage::getSingleton('wishlist/session')->addError($this->__('Cannot update wishlist')); $redirectUrl = $indexUrl; } diff --git a/app/code/core/Mage/Wishlist/Helper/Data.php b/app/code/core/Mage/Wishlist/Helper/Data.php index f3fdb1523bf..804d7a08ee7 100644 --- a/app/code/core/Mage/Wishlist/Helper/Data.php +++ b/app/code/core/Mage/Wishlist/Helper/Data.php @@ -258,7 +258,7 @@ protected function _getUrlStore($item) if ($product) { if ($product->isVisibleInSiteVisibility()) { $storeId = $product->getStoreId(); - } else if ($product->hasUrlDataObject()) { + } elseif ($product->hasUrlDataObject()) { $storeId = $product->getUrlDataObject()->getStoreId(); } } diff --git a/app/code/core/Mage/Wishlist/Model/Config/Source/Summary.php b/app/code/core/Mage/Wishlist/Model/Config/Source/Summary.php index fc4b1f42139..c0cb28581bf 100644 --- a/app/code/core/Mage/Wishlist/Model/Config/Source/Summary.php +++ b/app/code/core/Mage/Wishlist/Model/Config/Source/Summary.php @@ -25,6 +25,9 @@ */ class Mage_Wishlist_Model_Config_Source_Summary { + /** + * @return array + */ public function toOptionArray() { return array( diff --git a/app/code/core/Mage/Wishlist/Model/Item.php b/app/code/core/Mage/Wishlist/Model/Item.php index 9298da80361..263fde84737 100644 --- a/app/code/core/Mage/Wishlist/Model/Item.php +++ b/app/code/core/Mage/Wishlist/Model/Item.php @@ -24,28 +24,34 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Wishlist item model * * @method Mage_Wishlist_Model_Resource_Item getResource() - * @method int getWishlistId() - * @method Mage_Wishlist_Model_Item setWishlistId(int $value) - * @method int getProductId() - * @method Mage_Wishlist_Model_Item setProductId(int $value) - * @method int getStoreId() - * @method Mage_Wishlist_Model_Item setStoreId(int $value) + * @method Mage_Wishlist_Model_Resource_Item_Collection getCollection() + * * @method string getAddedAt() - * @method Mage_Wishlist_Model_Item setAddedAt(string $value) + * @method $this setAddedAt(string $value) * @method string getDescription() - * @method Mage_Wishlist_Model_Item setDescription(string $value) + * @method $this setDescription(string $value) + * @method bool getHasError() + * @method string getMessage() + * @method $this setProduct(Mage_Catalog_Model_Product $value) + * @method int getProductId() + * @method $this setProductId(int $value) + * @method $this unsProduct() + * @method float getQty() + * @method int getStoreId() + * @method $this setStoreId(int $value) + * @method int getWishlistId() + * @method $this setWishlistId(int $value)Mage_Wishlist_Model_Resource_Item + * @method $this setWishlist(Mage_Wishlist_Model_Wishlist $param) * * @category Mage * @package Mage_Wishlist * @author Magento Core Team */ -class Mage_Wishlist_Model_Item extends Mage_Core_Model_Abstract - implements Mage_Catalog_Model_Product_Configuration_Item_Interface +class Mage_Wishlist_Model_Item extends Mage_Core_Model_Abstract implements Mage_Catalog_Model_Product_Configuration_Item_Interface { const EXCEPTION_CODE_NOT_SALABLE = 901; const EXCEPTION_CODE_HAS_REQUIRED_OPTIONS = 902; @@ -65,7 +71,7 @@ class Mage_Wishlist_Model_Item extends Mage_Core_Model_Abstract */ protected $_customOptionDownloadUrl = 'wishlist/index/downloadCustomOption'; - /** + /** * Prefix of model events names * * @var string @@ -126,14 +132,14 @@ protected function _construct() */ public function setQty($qty) { - $this->setData('qty', ($qty >= 0) ? $qty : 1 ); + $this->setData('qty', ($qty >= 0) ? $qty : 1); return $this; } /** * Retrieve resource instance wrapper * - * @return Mage_Wishlist_Model_Mysql4_Item + * @inheritDoc */ protected function _getResource() { @@ -165,14 +171,13 @@ protected function _compareOptions($options1, $options2) * Register option code * * @param Mage_Wishlist_Model_Item_Option $option - * @return Mage_Wishlist_Model_Item + * @return $this */ protected function _addOptionCode($option) { if (!isset($this->_optionsByCode[$option->getCode()])) { $this->_optionsByCode[$option->getCode()] = $option; - } - else { + } else { Mage::throwException(Mage::helper('sales')->__('An item option with code %s already exists.', $option->getCode())); } return $this; @@ -234,7 +239,7 @@ public function save() /** * Save item options after item saved * - * @return $this + * @inheritDoc */ protected function _afterSave() { @@ -331,8 +336,10 @@ public function getProduct() $product = $this->_getData('product'); if (is_null($product)) { if (!$this->getProductId()) { - throw new Mage_Core_Exception(Mage::helper('wishlist')->__('Cannot specify product.'), - self::EXCEPTION_CODE_NOT_SPECIFIED_PRODUCT); + throw new Mage_Core_Exception( + Mage::helper('wishlist')->__('Cannot specify product.'), + self::EXCEPTION_CODE_NOT_SPECIFIED_PRODUCT + ); } $product = Mage::getModel('catalog/product') @@ -441,7 +448,8 @@ public function getBuyRequest() * @param array|Varien_Object $buyRequest * @return $this */ - public function mergeBuyRequest($buyRequest) { + public function mergeBuyRequest($buyRequest) + { if ($buyRequest instanceof Varien_Object) { $buyRequest = $buyRequest->getData(); } @@ -501,7 +509,7 @@ public function isRepresent($product, $buyRequest) return false; } if (empty($selfOptions) && !empty($buyRequest)) { - if (!$product->isComposite()){ + if (!$product->isComposite()) { return true; } else { return false; @@ -510,10 +518,10 @@ public function isRepresent($product, $buyRequest) $requestArray = $buyRequest->getData(); - if(!$this->_compareOptions($requestArray, $selfOptions)){ + if (!$this->_compareOptions($requestArray, $selfOptions)) { return false; } - if(!$this->_compareOptions($selfOptions, $requestArray)){ + if (!$this->_compareOptions($selfOptions, $requestArray)) { return false; } return true; @@ -535,10 +543,10 @@ public function representProduct($product) $itemOptions = $this->getOptionsByCode(); $productOptions = $product->getCustomOptions(); - if(!$this->compareOptions($itemOptions, $productOptions)){ + if (!$this->compareOptions($itemOptions, $productOptions)) { return false; } - if(!$this->compareOptions($productOptions, $itemOptions)){ + if (!$this->compareOptions($productOptions, $itemOptions)) { return false; } return true; @@ -557,10 +565,10 @@ public function compareOptions($options1, $options2) { foreach ($options1 as $option) { $code = $option->getCode(); - if (in_array($code, $this->_notRepresentOptions )) { + if (in_array($code, $this->_notRepresentOptions)) { continue; } - if ( !isset($options2[$code]) + if (!isset($options2[$code]) || ($options2[$code]->getValue() === null) || $options2[$code]->getValue() != $option->getValue()) { return false; @@ -573,7 +581,7 @@ public function compareOptions($options1, $options2) * Initialize item options * * @param array $options - * @return Mage_Wishlist_Model_Item + * @return $this */ public function setOptions($options) { @@ -607,16 +615,16 @@ public function getOptionsByCode() * Add option to item * * @param Mage_Wishlist_Model_Item_Option $option - * @return Mage_Wishlist_Model_Item + * @return $this */ public function addOption($option) { if (is_array($option)) { $option = Mage::getModel('wishlist/item_option')->setData($option) ->setItem($this); - } else if ($option instanceof Mage_Wishlist_Model_Item_Option) { + } elseif ($option instanceof Mage_Wishlist_Model_Item_Option) { $option->setItem($this); - } else if ($option instanceof Varien_Object) { + } elseif ($option instanceof Varien_Object) { $option = Mage::getModel('wishlist/item_option')->setData($option->getData()) ->setProduct($option->getProduct()) ->setItem($this); @@ -653,7 +661,7 @@ public function removeOption($code) * Get item option by code * * @param string $code - * @return Mage_Wishlist_Model_Item_Option || null + * @return Mage_Wishlist_Model_Item_Option|null */ public function getOptionByCode($code) { @@ -684,6 +692,7 @@ public function getCustomDownloadUrl() /** * Sets custom option download url + * @param string $url */ public function setCustomDownloadUrl($url) { @@ -696,7 +705,7 @@ public function setCustomDownloadUrl($url) * * We have to customize only controller url, so return it. * - * @return null|Varien_Object + * @return Varien_Object */ public function getFileDownloadParams() { diff --git a/app/code/core/Mage/Wishlist/Model/Item/Option.php b/app/code/core/Mage/Wishlist/Model/Item/Option.php index aba55838e10..71ff069e0d8 100644 --- a/app/code/core/Mage/Wishlist/Model/Item/Option.php +++ b/app/code/core/Mage/Wishlist/Model/Item/Option.php @@ -30,9 +30,15 @@ * @category Mage * @package Mage_Wishlist * @author Magento Core Team + * + * @method Mage_Wishlist_Model_Resource_Item_Option_Collection getCollection() + * @method string getCode() + * @method int getProductId() + * @method $this setProductId(int $value) + * @method $this setWishlistItemId(int $value) + * @method $this setValue(string $sBuyRequest) */ -class Mage_Wishlist_Model_Item_Option extends Mage_Core_Model_Abstract - implements Mage_Catalog_Model_Product_Configuration_Item_Option_Interface +class Mage_Wishlist_Model_Item_Option extends Mage_Core_Model_Abstract implements Mage_Catalog_Model_Product_Configuration_Item_Option_Interface { protected $_item; protected $_product; @@ -118,7 +124,7 @@ public function getValue() /** * Initialize item identifier before save data * - * @return $this + * @inheritDoc */ protected function _beforeSave() { diff --git a/app/code/core/Mage/Wishlist/Model/Observer.php b/app/code/core/Mage/Wishlist/Model/Observer.php index 507b02e4f82..98477399fa9 100644 --- a/app/code/core/Mage/Wishlist/Model/Observer.php +++ b/app/code/core/Mage/Wishlist/Model/Observer.php @@ -35,7 +35,7 @@ class Mage_Wishlist_Model_Observer extends Mage_Core_Model_Abstract * Get customer wishlist model instance * * @param int $customerId - * @return Mage_Wishlist_Model_Wishlist || false + * @return Mage_Wishlist_Model_Wishlist|false */ protected function _getWishlist($customerId) { @@ -89,8 +89,12 @@ public function processCartUpdateBefore($observer) return $this; } + /** + * @param Varien_Event_Observer $observer + */ public function processAddToCart($observer) { + /** @var Mage_Core_Controller_Request_Http $request */ $request = $observer->getEvent()->getRequest(); $sharedWishlist = Mage::getSingleton('checkout/session')->getSharedWishlist(); $messages = Mage::getSingleton('checkout/session')->getWishlistPendingMessages(); @@ -102,13 +106,13 @@ public function processAddToCart($observer) $wishlistIds = array($singleWishlistId); } - if (!empty($wishlistIds) && $request->getParam('wishlist_next')){ + if (!empty($wishlistIds) && $request->getParam('wishlist_next')) { $wishlistId = array_shift($wishlistIds); if (Mage::getSingleton('customer/session')->isLoggedIn()) { $wishlist = Mage::getModel('wishlist/wishlist') ->loadByCustomer(Mage::getSingleton('customer/session')->getCustomer(), true); - } else if ($sharedWishlist) { + } elseif ($sharedWishlist) { $wishlist = Mage::getModel('wishlist/wishlist')->loadByCode($sharedWishlist); } else { return; @@ -117,9 +121,10 @@ public function processAddToCart($observer) $wishlist->getItemCollection()->load(); - foreach($wishlist->getItemCollection() as $wishlistItem){ - if ($wishlistItem->getId() == $wishlistId) + foreach ($wishlist->getItemCollection() as $wishlistItem) { + if ($wishlistItem->getId() == $wishlistId) { $wishlistItem->delete(); + } } Mage::getSingleton('checkout/session')->setWishlistIds($wishlistIds); Mage::getSingleton('checkout/session')->setSingleWishlistId(null); @@ -164,5 +169,4 @@ public function customerLogout(Varien_Event_Observer $observer) return $this; } - } diff --git a/app/code/core/Mage/Wishlist/Model/Resource/Item/Collection.php b/app/code/core/Mage/Wishlist/Model/Resource/Item/Collection.php index f910fb39848..e6d6ea79803 100644 --- a/app/code/core/Mage/Wishlist/Model/Resource/Item/Collection.php +++ b/app/code/core/Mage/Wishlist/Model/Resource/Item/Collection.php @@ -31,6 +31,9 @@ * @category Mage * @package Mage_Wishlist * @author Magento Core Team + * + * @method Mage_Wishlist_Model_Item getItemById(int|string $value) + * @method Mage_Wishlist_Model_Item[] getItems() */ class Mage_Wishlist_Model_Resource_Item_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract { @@ -145,11 +148,11 @@ protected function _afterLoad() protected function _assignOptions() { $itemIds = array_keys($this->_items); - /* @var $optionCollection Mage_Wishlist_Model_Resource_Item_Option_Collection */ + /* @var Mage_Wishlist_Model_Resource_Item_Option_Collection $optionCollection */ $optionCollection = Mage::getModel('wishlist/item_option')->getCollection(); $optionCollection->addItemFilter($itemIds); - /* @var $item Mage_Wishlist_Model_Item */ + /* @var Mage_Wishlist_Model_Item $item */ foreach ($this as $item) { $item->setOptions($optionCollection->getOptionsByItem($item)); } @@ -492,7 +495,8 @@ public function setOrderByProductName($dir) * * @return int */ - public function getItemsQty(){ + public function getItemsQty() + { if (is_null($this->_itemsQty)) { $this->_itemsQty = 0; foreach ($this as $wishlistItem) { diff --git a/app/code/core/Mage/Wishlist/Model/Resource/Item/Option/Collection.php b/app/code/core/Mage/Wishlist/Model/Resource/Item/Option/Collection.php index 1b496a3f36f..8b9dd6e8cc3 100644 --- a/app/code/core/Mage/Wishlist/Model/Resource/Item/Option/Collection.php +++ b/app/code/core/Mage/Wishlist/Model/Resource/Item/Option/Collection.php @@ -97,9 +97,9 @@ public function addItemFilter($item) if (empty($item)) { $this->_totalRecords = 0; $this->_setIsLoaded(true); - } else if (is_array($item)) { + } elseif (is_array($item)) { $this->addFieldToFilter('wishlist_item_id', array('in' => $item)); - } else if ($item instanceof Mage_Wishlist_Model_Item) { + } elseif ($item instanceof Mage_Wishlist_Model_Item) { $this->addFieldToFilter('wishlist_item_id', $item->getId()); } else { $this->addFieldToFilter('wishlist_item_id', $item); @@ -149,7 +149,7 @@ public function getOptionsByItem($item) /** * Get all option for item * - * @param mixed $item + * @param int|Mage_Catalog_Model_Product $product * @return array */ public function getOptionsByProduct($product) diff --git a/app/code/core/Mage/Wishlist/Model/Resource/Product/Collection.php b/app/code/core/Mage/Wishlist/Model/Resource/Product/Collection.php index 3e7aefee4f6..e64598bfcb3 100644 --- a/app/code/core/Mage/Wishlist/Model/Resource/Product/Collection.php +++ b/app/code/core/Mage/Wishlist/Model/Resource/Product/Collection.php @@ -63,7 +63,7 @@ public function getDaysInWishlist() /** * Set add days in whishlist filter of product collection flag * - * @param unknown_type $flag + * @param bool $flag * @return $this */ public function setDaysInWishlist($flag) @@ -147,7 +147,8 @@ public function addStoreData() $nowDate = $adapter->formatDate(Mage::getSingleton('core/date')->date()); $this->joinField('store_name', 'core/store', 'name', 'store_id=item_store_id'); - $this->joinField('days_in_wishlist', + $this->joinField( + 'days_in_wishlist', 'wishlist/item', $resourceHelper->getDateDiff($this->_wishlistItemTableAlias . '.added_at', $nowDate), 'wishlist_item_id=wishlist_item_id' @@ -159,8 +160,7 @@ public function addStoreData() /** * Rewrite retrieve attribute field name for wishlist attributes * - * @param string $attributeCode - * @return $this + * @inheritDoc */ protected function _getAttributeFieldName($attributeCode) { @@ -174,7 +174,9 @@ protected function _getAttributeFieldName($attributeCode) * Prevent loading collection because after Magento 1.4.2.0 it's impossible * to use product collection in wishlist * - * @return bool + * @param bool $printQuery + * @param bool $logQuery + * @return Mage_Wishlist_Model_Resource_Product_Collection */ public function load($printQuery = false, $logQuery = false) { diff --git a/app/code/core/Mage/Wishlist/Model/Resource/Wishlist.php b/app/code/core/Mage/Wishlist/Model/Resource/Wishlist.php index 2148cc13bda..9b9fa6dcb41 100644 --- a/app/code/core/Mage/Wishlist/Model/Resource/Wishlist.php +++ b/app/code/core/Mage/Wishlist/Model/Resource/Wishlist.php @@ -87,8 +87,7 @@ public function getCustomerIdFieldName() /** * Setter for customer ID field name * - * @param $fieldName - * + * @param string $fieldName * @return $this */ public function setCustomerIdFieldName($fieldName) @@ -115,5 +114,4 @@ public function fetchItemsCount(Mage_Wishlist_Model_Wishlist $wishlist) return $this->_itemsCount; } - } diff --git a/app/code/core/Mage/Wishlist/Model/Resource/Wishlist/Collection.php b/app/code/core/Mage/Wishlist/Model/Resource/Wishlist/Collection.php index b6a582917de..e671c89d6ed 100644 --- a/app/code/core/Mage/Wishlist/Model/Resource/Wishlist/Collection.php +++ b/app/code/core/Mage/Wishlist/Model/Resource/Wishlist/Collection.php @@ -24,13 +24,14 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Wislist model collection * * @category Mage * @package Mage_Wishlist * @author Magento Core Team + * + * @method Mage_Wishlist_Model_Wishlist[] getItems() */ class Mage_Wishlist_Model_Resource_Wishlist_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract { diff --git a/app/code/core/Mage/Wishlist/Model/Session.php b/app/code/core/Mage/Wishlist/Model/Session.php index 41066fd58a0..3bbcd3927bf 100644 --- a/app/code/core/Mage/Wishlist/Model/Session.php +++ b/app/code/core/Mage/Wishlist/Model/Session.php @@ -24,20 +24,19 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Wishlist session model * * @category Mage * @package Mage_Wishlist * @author Magento Core Team + * + * @method $this setSharingForm(array $value) */ class Mage_Wishlist_Model_Session extends Mage_Core_Model_Session_Abstract { - public function __construct() { $this->init('wishlist'); } - } diff --git a/app/code/core/Mage/Wishlist/Model/Wishlist.php b/app/code/core/Mage/Wishlist/Model/Wishlist.php index 07898537ac9..b56ef17e5e8 100644 --- a/app/code/core/Mage/Wishlist/Model/Wishlist.php +++ b/app/code/core/Mage/Wishlist/Model/Wishlist.php @@ -30,12 +30,15 @@ * * @method Mage_Wishlist_Model_Resource_Wishlist _getResource() * @method Mage_Wishlist_Model_Resource_Wishlist getResource() + * @method Mage_Wishlist_Model_Resource_Wishlist_Collection getCollection() + * * @method int getShared() - * @method Mage_Wishlist_Model_Wishlist setShared(int $value) + * @method $this setShared(int $value) * @method string getSharingCode() - * @method Mage_Wishlist_Model_Wishlist setSharingCode(string $value) + * @method $this setSharingCode(string $value) * @method string getUpdatedAt() - * @method Mage_Wishlist_Model_Wishlist setUpdatedAt(string $value) + * @method $this setUpdatedAt(string $value) + * @method string getVisibility() * * @category Mage * @package Mage_Wishlist @@ -144,7 +147,7 @@ public function generateSharingCode() public function loadByCode($code) { $this->_getResource()->load($this, $code, 'sharing_code'); - if(!$this->getShared()) { + if (!$this->getShared()) { $this->setId(null); } @@ -176,7 +179,7 @@ protected function _beforeSave() /** * Save related items * - * @return Mage_Sales_Model_Quote + * @return $this */ protected function _afterSave() { @@ -238,12 +241,12 @@ protected function _addCatalogProduct(Mage_Catalog_Model_Product $product, $qty /** * Retrieve wishlist item collection * - * @return Mage_Wishlist_Model_Mysql4_Item_Collection + * @return Mage_Wishlist_Model_Resource_Item_Collection + * @throws Mage_Core_Model_Store_Exception */ public function getItemCollection() { if (is_null($this->_itemCollection)) { - /** @var $currentWebsiteOnly boolean */ $currentWebsiteOnly = !Mage::app()->getStore()->isAdmin(); $this->_itemCollection = Mage::getResourceModel('wishlist/item_collection') ->addWishlistFilter($this) @@ -264,7 +267,7 @@ public function getItemCollection() * Retrieve wishlist item collection * * @param int $itemId - * @return Mage_Wishlist_Model_Item + * @return Mage_Wishlist_Model_Item|false */ public function getItem($itemId) { @@ -296,7 +299,7 @@ public function getProductCollection() * Adding item to wishlist * * @param Mage_Wishlist_Model_Item $item - * @return Mage_Wishlist_Model_Wishlist + * @return $this */ public function addItem(Mage_Wishlist_Model_Item $item) { @@ -337,7 +340,7 @@ public function addNewItem($product, $buyRequest = null, $forciblySetQty = false } } - /* @var $product Mage_Catalog_Model_Product */ + /* @var Mage_Catalog_Model_Product $product */ $product = Mage::getModel('catalog/product') ->setStoreId($storeId) ->load($productId); @@ -563,7 +566,7 @@ public function updateItem($itemId, $buyRequest, $params = null) if ($productId) { if (!$params) { $params = new Varien_Object(); - } else if (is_array($params)) { + } elseif (is_array($params)) { $params = new Varien_Object($params); } $params->setCurrentConfig($item->getBuyRequest()); @@ -573,7 +576,7 @@ public function updateItem($itemId, $buyRequest, $params = null) $items = $this->getItemCollection(); $isForceSetQuantity = true; foreach ($items as $_item) { - /* @var $_item Mage_Wishlist_Model_Item */ + /* @var Mage_Wishlist_Model_Item $_item */ if ($_item->getProductId() == $product->getId() && $_item->representProduct($product) && $_item->getId() != $item->getId()) { @@ -608,7 +611,7 @@ public function updateItem($itemId, $buyRequest, $params = null) /** * Save wishlist. * - * @return $this + * @inheritDoc */ public function save() { diff --git a/app/code/core/Mage/Wishlist/controllers/IndexController.php b/app/code/core/Mage/Wishlist/controllers/IndexController.php index 739f6587047..88020feb86c 100644 --- a/app/code/core/Mage/Wishlist/controllers/IndexController.php +++ b/app/code/core/Mage/Wishlist/controllers/IndexController.php @@ -31,6 +31,9 @@ * @category Mage * @package Mage_Wishlist * @author Magento Core Team + * + * @method float getQty() + * @method int getProductId() */ class Mage_Wishlist_IndexController extends Mage_Wishlist_Controller_Abstract { @@ -118,7 +121,8 @@ protected function _getWishlist($wishlistId = null) Mage::getSingleton('wishlist/session')->addError($e->getMessage()); return false; } catch (Exception $e) { - Mage::getSingleton('wishlist/session')->addException($e, + Mage::getSingleton('wishlist/session')->addException( + $e, Mage::helper('wishlist')->__('Wishlist could not be created.') ); return false; @@ -239,13 +243,15 @@ protected function _addItemToWishList() Mage::helper('wishlist')->calculate(); - $message = $this->__('%1$s has been added to your wishlist. Click here to continue shopping.', - $product->getName(), Mage::helper('core')->escapeUrl($referer)); + $message = $this->__( + '%1$s has been added to your wishlist. Click here to continue shopping.', + $product->getName(), + Mage::helper('core')->escapeUrl($referer) + ); $session->addSuccess($message); } catch (Mage_Core_Exception $e) { $session->addError($this->__('An error occurred while adding item to wishlist: %s', $e->getMessage())); - } - catch (Exception $e) { + } catch (Exception $e) { $session->addError($this->__('An error occurred while adding item to wishlist.')); } @@ -259,7 +265,7 @@ public function configureAction() { $id = (int) $this->getRequest()->getParam('id'); try { - /* @var $item Mage_Wishlist_Model_Item */ + /* @var Mage_Wishlist_Model_Item $item */ $item = Mage::getModel('wishlist/item'); $item->loadWithOptions($id); if (!$item->getId()) { @@ -334,8 +340,7 @@ public function updateItemOptionsAction() Mage::helper('wishlist')->calculate(); Mage::dispatchEvent('wishlist_update_item', array( - 'wishlist' => $wishlist, 'product' => $product, 'item' => $wishlist->getItem($id)) - ); + 'wishlist' => $wishlist, 'product' => $product, 'item' => $wishlist->getItem($id))); Mage::helper('wishlist')->calculate(); @@ -484,7 +489,7 @@ public function cartAction() } $itemId = (int) $this->getRequest()->getParam('item'); - /* @var $item Mage_Wishlist_Model_Item */ + /* @var Mage_Wishlist_Model_Item $item */ $item = Mage::getModel('wishlist/item')->load($itemId); if (!$item->getId()) { return $this->_redirect('*/*'); @@ -508,7 +513,7 @@ public function cartAction() $item->setQty($qty); } - /* @var $session Mage_Wishlist_Model_Session */ + /* @var Mage_Wishlist_Model_Session $session */ $session = Mage::getSingleton('wishlist/session'); $cart = Mage::getSingleton('checkout/cart'); @@ -546,7 +551,7 @@ public function cartAction() } catch (Mage_Core_Exception $e) { if ($e->getCode() == Mage_Wishlist_Model_Item::EXCEPTION_CODE_NOT_SALABLE) { $session->addError($this->__('This product(s) is currently out of stock')); - } else if ($e->getCode() == Mage_Wishlist_Model_Item::EXCEPTION_CODE_HAS_REQUIRED_OPTIONS) { + } elseif ($e->getCode() == Mage_Wishlist_Model_Item::EXCEPTION_CODE_HAS_REQUIRED_OPTIONS) { Mage::getSingleton('catalog/session')->addNotice($e->getMessage()); $redirectUrl = Mage::getUrl('*/*/configure/', array('id' => $item->getId())); } else { @@ -643,11 +648,9 @@ public function sendAction() $error = false; if (empty($emails)) { $error = $this->__('Email address can\'t be empty.'); - } - elseif (count($emails) > 5) { + } elseif (count($emails) > 5) { $error = $this->__('Please enter no more than 5 email addresses.'); - } - else { + } else { foreach ($emails as $index => $email) { $email = trim($email); if (!Zend_Validate::is($email, 'EmailAddress')) { @@ -665,7 +668,7 @@ public function sendAction() } $translate = Mage::getSingleton('core/translate'); - /* @var $translate Mage_Core_Model_Translate */ + /* @var Mage_Core_Model_Translate $translate */ $translate->setTranslateInline(false); try { @@ -682,7 +685,7 @@ public function sendAction() $wishlistBlock = $this->getLayout()->createBlock('wishlist/share_email_items')->toHtml(); $emails = array_unique($emails); - /* @var $emailModel Mage_Core_Model_Email_Template */ + /* @var Mage_Core_Model_Email_Template $emailModel */ $emailModel = Mage::getModel('core/email_template'); $sharingCode = $wishlist->getSharingCode(); @@ -713,8 +716,7 @@ public function sendAction() $this->__('Your Wishlist has been shared.') ); $this->_redirect('*/*', array('wishlist_id' => $wishlist->getId())); - } - catch (Exception $e) { + } catch (Exception $e) { $translate->setTranslateInline(true); Mage::getSingleton('wishlist/session')->addError($e->getMessage()); @@ -763,7 +765,6 @@ public function downloadCustomOptionAction() 'type' => 'filename' )); } - } catch (Exception $e) { $this->_forward('noRoute'); } diff --git a/app/code/core/Mage/Wishlist/controllers/SharedController.php b/app/code/core/Mage/Wishlist/controllers/SharedController.php index 3272f8f9101..f4fdf8371ba 100644 --- a/app/code/core/Mage/Wishlist/controllers/SharedController.php +++ b/app/code/core/Mage/Wishlist/controllers/SharedController.php @@ -96,12 +96,12 @@ public function cartAction() $itemId = (int) $this->getRequest()->getParam('item'); $code = $this->getRequest()->getParam('code'); - /* @var $item Mage_Wishlist_Model_Item */ + /* @var Mage_Wishlist_Model_Item $item */ $item = Mage::getModel('wishlist/item')->load($itemId); $wishlist = Mage::getModel('wishlist/wishlist')->loadByCode($code); $redirectUrl = Mage::getUrl('*/*/index', array('code' => $code)); - /* @var $session Mage_Wishlist_Model_Session */ + /* @var Mage_Wishlist_Model_Session $session */ $session = Mage::getSingleton('wishlist/session'); $cart = Mage::getSingleton('checkout/cart'); diff --git a/app/code/core/Mage/Wishlist/sql/wishlist_setup/install-1.6.0.0.php b/app/code/core/Mage/Wishlist/sql/wishlist_setup/install-1.6.0.0.php index f5555ce452f..0c6adb4c6d5 100644 --- a/app/code/core/Mage/Wishlist/sql/wishlist_setup/install-1.6.0.0.php +++ b/app/code/core/Mage/Wishlist/sql/wishlist_setup/install-1.6.0.0.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); @@ -58,10 +58,16 @@ ->addIndex( $installer->getIdxName('wishlist/wishlist', 'customer_id', Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE), 'customer_id', - array('type'=>Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE)) - ->addForeignKey($installer->getFkName('wishlist/wishlist', 'customer_id', 'customer/entity', 'entity_id'), - 'customer_id', $installer->getTable('customer/entity'), 'entity_id', - Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE) + array('type'=>Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE) + ) + ->addForeignKey( + $installer->getFkName('wishlist/wishlist', 'customer_id', 'customer/entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer/entity'), + 'entity_id', + Varien_Db_Ddl_Table::ACTION_CASCADE, + Varien_Db_Ddl_Table::ACTION_CASCADE + ) ->setComment('Wishlist main Table'); $installer->getConnection()->createTable($table); @@ -98,17 +104,32 @@ 'nullable' => false, ), 'Qty') ->addIndex($installer->getIdxName('wishlist/item', 'wishlist_id'), 'wishlist_id') - ->addForeignKey($installer->getFkName('wishlist/item', 'wishlist_id', 'wishlist/wishlist', 'wishlist_id'), - 'wishlist_id', $installer->getTable('wishlist/wishlist'), 'wishlist_id', - Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE) + ->addForeignKey( + $installer->getFkName('wishlist/item', 'wishlist_id', 'wishlist/wishlist', 'wishlist_id'), + 'wishlist_id', + $installer->getTable('wishlist/wishlist'), + 'wishlist_id', + Varien_Db_Ddl_Table::ACTION_CASCADE, + Varien_Db_Ddl_Table::ACTION_CASCADE + ) ->addIndex($installer->getIdxName('wishlist/item', 'product_id'), 'product_id') - ->addForeignKey($installer->getFkName('wishlist/item', 'product_id', 'catalog/product', 'entity_id'), - 'product_id', $installer->getTable('catalog/product'), 'entity_id', - Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE) + ->addForeignKey( + $installer->getFkName('wishlist/item', 'product_id', 'catalog/product', 'entity_id'), + 'product_id', + $installer->getTable('catalog/product'), + 'entity_id', + Varien_Db_Ddl_Table::ACTION_CASCADE, + Varien_Db_Ddl_Table::ACTION_CASCADE + ) ->addIndex($installer->getIdxName('wishlist/item', 'store_id'), 'store_id') - ->addForeignKey($installer->getFkName('wishlist/item', 'store_id', 'core/store', 'store_id'), - 'store_id', $installer->getTable('core/store'), 'store_id', - Varien_Db_Ddl_Table::ACTION_SET_NULL, Varien_Db_Ddl_Table::ACTION_CASCADE) + ->addForeignKey( + $installer->getFkName('wishlist/item', 'store_id', 'core/store', 'store_id'), + 'store_id', + $installer->getTable('core/store'), + 'store_id', + Varien_Db_Ddl_Table::ACTION_SET_NULL, + Varien_Db_Ddl_Table::ACTION_CASCADE + ) ->setComment('Wishlist items'); $installer->getConnection()->createTable($table); @@ -139,8 +160,12 @@ ), 'Value') ->addForeignKey( $installer->getFkName('wishlist/item_option', 'wishlist_item_id', 'wishlist/item', 'wishlist_item_id'), - 'wishlist_item_id', $installer->getTable('wishlist/item'), 'wishlist_item_id', - Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE) + 'wishlist_item_id', + $installer->getTable('wishlist/item'), + 'wishlist_item_id', + Varien_Db_Ddl_Table::ACTION_CASCADE, + Varien_Db_Ddl_Table::ACTION_CASCADE + ) ->setComment('Wishlist Item Option Table'); $installer->getConnection()->createTable($table); diff --git a/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-install-0.7.0.php b/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-install-0.7.0.php index 6db381e678b..e494566b227 100644 --- a/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-install-0.7.0.php +++ b/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-install-0.7.0.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); diff --git a/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-0.7.0-0.7.1.php b/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-0.7.0-0.7.1.php index d07b40d8804..9139afa9c6b 100644 --- a/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-0.7.0-0.7.1.php +++ b/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-0.7.0-0.7.1.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); diff --git a/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-0.7.1-0.7.2.php b/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-0.7.1-0.7.2.php index f30ddd26a6a..7166134e509 100644 --- a/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-0.7.1-0.7.2.php +++ b/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-0.7.1-0.7.2.php @@ -33,7 +33,7 @@ */ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); diff --git a/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-0.7.2-0.7.4.php b/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-0.7.2-0.7.4.php index 31a93dd8bf3..a5fb3989777 100644 --- a/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-0.7.2-0.7.4.php +++ b/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-0.7.2-0.7.4.php @@ -33,7 +33,7 @@ */ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); diff --git a/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-0.7.4-0.7.5.php b/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-0.7.4-0.7.5.php index a014aa18c62..4456485bc34 100644 --- a/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-0.7.4-0.7.5.php +++ b/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-0.7.4-0.7.5.php @@ -25,7 +25,7 @@ */ -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer = $this; $installer->startSetup(); @@ -40,8 +40,11 @@ $installer->getConnection()->dropKey($installer->getTable('wishlist/item'), 'FK_WISHLIST_STORE'); $installer->getConnection()->dropKey($installer->getTable('wishlist/wishlist'), 'FK_CUSTOMER'); -$installer->getConnection()->modifyColumn($installer->getTable('wishlist/item'), 'store_id', - 'smallint UNSIGNED DEFAULT NULL'); +$installer->getConnection()->modifyColumn( + $installer->getTable('wishlist/item'), + 'store_id', + 'smallint UNSIGNED DEFAULT NULL' +); $installer->getConnection()->addKey($installer->getTable('wishlist/item'), 'IDX_WISHLIST', 'wishlist_id'); $installer->getConnection()->addKey($installer->getTable('wishlist/item'), 'IDX_PRODUCT', 'product_id'); @@ -49,25 +52,41 @@ $installer->getConnection()->addKey($installer->getTable('wishlist/wishlist'), 'UNQ_CUSTOMER', 'customer_id', 'unique'); $installer->getConnection()->addKey($installer->getTable('wishlist/wishlist'), 'IDX_IS_SHARED', 'shared'); -$installer->getConnection()->addConstraint('FK_WISHLIST_ITEM_STORE', - $installer->getTable('wishlist/item'), 'store_id', - $installer->getTable('core/store'), 'store_id', - 'set null', 'cascade' +$installer->getConnection()->addConstraint( + 'FK_WISHLIST_ITEM_STORE', + $installer->getTable('wishlist/item'), + 'store_id', + $installer->getTable('core/store'), + 'store_id', + 'set null', + 'cascade' ); -$installer->getConnection()->addConstraint('FK_WISHLIST_ITEM_WISHLIST', - $installer->getTable('wishlist/item'), 'wishlist_id', - $installer->getTable('wishlist/wishlist'), 'wishlist_id', - 'cascade', 'cascade' +$installer->getConnection()->addConstraint( + 'FK_WISHLIST_ITEM_WISHLIST', + $installer->getTable('wishlist/item'), + 'wishlist_id', + $installer->getTable('wishlist/wishlist'), + 'wishlist_id', + 'cascade', + 'cascade' ); -$installer->getConnection()->addConstraint('FK_WISHLIST_ITEM_PRODUCT', - $installer->getTable('wishlist/item'), 'product_id', - $installer->getTable('catalog/product'), 'entity_id', - 'cascade', 'cascade' +$installer->getConnection()->addConstraint( + 'FK_WISHLIST_ITEM_PRODUCT', + $installer->getTable('wishlist/item'), + 'product_id', + $installer->getTable('catalog/product'), + 'entity_id', + 'cascade', + 'cascade' ); -$installer->getConnection()->addConstraint('FK_WISHLIST_CUSTOMER', - $installer->getTable('wishlist/wishlist'), 'customer_id', - $installer->getTable('customer/entity'), 'entity_id', - 'cascade', 'cascade' +$installer->getConnection()->addConstraint( + 'FK_WISHLIST_CUSTOMER', + $installer->getTable('wishlist/wishlist'), + 'customer_id', + $installer->getTable('customer/entity'), + 'entity_id', + 'cascade', + 'cascade' ); $installer->endSetup(); diff --git a/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-0.7.6-0.7.7.php b/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-0.7.6-0.7.7.php index e8f6e5fe9c9..bdf8b74cf59 100644 --- a/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-0.7.6-0.7.7.php +++ b/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-0.7.6-0.7.7.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer = $this; $installer->startSetup(); $installer->getConnection()->dropColumn($installer->getTable('wishlist'), 'is_dirty'); diff --git a/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-0.7.7-0.7.8.php b/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-0.7.7-0.7.8.php index cc379365f4a..c444afaedd5 100644 --- a/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-0.7.7-0.7.8.php +++ b/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-0.7.7-0.7.8.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer = $this; $installer->startSetup(); $installer->getConnection()->addColumn($this->getTable('wishlist'), 'updated_at', 'datetime NULL DEFAULT NULL'); diff --git a/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-0.7.8-0.7.9.php b/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-0.7.8-0.7.9.php index 2757401a479..7d537dd0f89 100644 --- a/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-0.7.8-0.7.9.php +++ b/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-0.7.8-0.7.9.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer = $this; $installer->startSetup(); $installer->getConnection()->addColumn($this->getTable('wishlist/item'), 'qty', 'DECIMAL( 12, 4 ) NOT NULL'); diff --git a/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php b/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php index 5452cca4dde..db20632af39 100644 --- a/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php +++ b/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer = $this; $installer->startSetup(); @@ -229,7 +229,8 @@ $installer->getIdxName( 'wishlist/wishlist', array('customer_id'), - Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE), + Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE + ), array('customer_id'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE );