Skip to content

Cast products "getStoreId()" to int, closes #18079 #18086

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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