Skip to content

Commit

Permalink
ENGCOM-3047: Cast products 'getStoreId()' to int, closes #18079 #18086
Browse files Browse the repository at this point in the history
 - Merge Pull Request #18086 from sreichel/magento2:develop/fix-getStoreId
 - Merged commits:
   1. 9d8b04a
  • Loading branch information
magento-engcom-team committed Sep 27, 2018
2 parents 4557bfe + 9d8b04a commit 78d865a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
13 changes: 9 additions & 4 deletions app/code/Magento/Catalog/Model/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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();
}
Expand All @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Catalog/Model/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

/**
Expand Down

0 comments on commit 78d865a

Please sign in to comment.