From 9d8b04a0c9700e8a5bfe65911c8151672f202de6 Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Sun, 16 Sep 2018 21:55:53 +0200 Subject: [PATCH] Cast products "getStoreId()" to int, closes #18079 --- app/code/Magento/Catalog/Model/Category.php | 13 +++++++++---- app/code/Magento/Catalog/Model/Product.php | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Category.php b/app/code/Magento/Catalog/Model/Category.php index 57cfa75380851..a12eae06d7ec9 100644 --- a/app/code/Magento/Catalog/Model/Category.php +++ b/app/code/Magento/Catalog/Model/Category.php @@ -71,6 +71,11 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements const CACHE_TAG = 'cat_c'; + /** + * Category Store Id + */ + const STORE_ID = 'store_id'; + /**#@+ * Constants */ @@ -588,12 +593,12 @@ public function getStoreIds() * * If store id is underfined for category return current active store id * - * @return integer + * @return int */ public function getStoreId() { - if ($this->hasData('store_id')) { - return (int)$this->_getData('store_id'); + if ($this->hasData(self::STORE_ID)) { + return (int)$this->_getData(self::STORE_ID); } return (int)$this->_storeManager->getStore()->getId(); } @@ -609,7 +614,7 @@ public function setStoreId($storeId) if (!is_numeric($storeId)) { $storeId = $this->_storeManager->getStore($storeId)->getId(); } - $this->setData('store_id', $storeId); + $this->setData(self::STORE_ID, $storeId); $this->getResource()->setStoreId($storeId); return $this; } diff --git a/app/code/Magento/Catalog/Model/Product.php b/app/code/Magento/Catalog/Model/Product.php index 850fb21777585..69a8ffd1665c7 100644 --- a/app/code/Magento/Catalog/Model/Product.php +++ b/app/code/Magento/Catalog/Model/Product.php @@ -525,9 +525,9 @@ protected function getCustomAttributesCodes() public function getStoreId() { if ($this->hasData(self::STORE_ID)) { - return $this->getData(self::STORE_ID); + return (int)$this->getData(self::STORE_ID); } - return $this->_storeManager->getStore()->getId(); + return (int)$this->_storeManager->getStore()->getId(); } /**