Skip to content

Commit 0c7a4b5

Browse files
committed
ACP2E-1522: Auto increment number jumping up for catalog_product_entity_* tables
- Fixed the build error.
1 parent 4f45d96 commit 0c7a4b5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

app/code/Magento/Catalog/Model/ResourceModel/AbstractResource.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@
2424
abstract class AbstractResource extends \Magento\Eav\Model\Entity\AbstractEntity
2525
{
2626
/**
27-
* Store manager
27+
* Store manager to get the store information
2828
*
2929
* @var \Magento\Store\Model\StoreManagerInterface
3030
*/
3131
protected $_storeManager;
3232

3333
/**
34-
* Model factory
34+
* Model factory to create a model object
3535
*
3636
* @var \Magento\Catalog\Model\Factory
3737
*/
@@ -327,7 +327,11 @@ protected function _updateAttribute($object, $attribute, $valueId, $value)
327327
{
328328
$entity = $attribute->getEntity();
329329
$row = $this->getAttributeRow($entity, $object, $attribute);
330-
if ($valueId > 0 && array_key_exists('store_id', $row)) {
330+
$hasSingleStore = $this->_storeManager->hasSingleStore();
331+
$storeId = $hasSingleStore
332+
? $this->getDefaultStoreId()
333+
: (int) $this->_storeManager->getStore($object->getStoreId())->getId();
334+
if ($valueId > 0 && array_key_exists('store_id', $row) && $storeId === $row['store_id']) {
331335
$table = $attribute->getBackend()->getTable();
332336
$connection = $this->getConnection();
333337
$connection->update(

0 commit comments

Comments
 (0)