Skip to content

Commit fbdd4a1

Browse files
committed
ACP2E-1522: Auto increment number jumping up for catalog_product_entity_* tables
- Fixed the build error.
1 parent 71ad851 commit fbdd4a1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

app/code/Magento/Eav/Model/Entity/AbstractEntity.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,7 +1704,7 @@ public function saveAttribute(DataObject $object, $attributeCode)
17041704
} elseif ($origValueId !== false && $newValue === null && $origValue !== null) {
17051705
$connection->delete($table, $where);
17061706
}
1707-
if ($updateValue === 1) {
1707+
if ($updateValue === 1 && $origValue === $newValue) {
17081708
$this->_updateAttributeValues($attribute, $origValueId);
17091709
} else {
17101710
$this->_processAttributeValues();
@@ -2026,7 +2026,7 @@ protected function loadAttributesForObject($attributes, $object = null)
20262026
* @return $this
20272027
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
20282028
*/
2029-
protected function _updateAttributeValues(AbstractAttribute $attribute, mixed $valueId): static
2029+
private function _updateAttributeValues(AbstractAttribute $attribute, mixed $valueId): static
20302030
{
20312031
$connection = $this->getConnection();
20322032
foreach ($this->_attributeValuesToSave as $table => $data) {
@@ -2039,9 +2039,13 @@ protected function _updateAttributeValues(AbstractAttribute $attribute, mixed $v
20392039
}
20402040
}
20412041

2042+
foreach ($this->_attributeValuesToDelete as $table => $valueIds) {
2043+
$connection->delete($table, ['value_id IN (?)' => $valueIds]);
2044+
}
2045+
20422046
// reset data arrays
20432047
$this->_attributeValuesToSave = [];
2044-
2048+
$this->_attributeValuesToDelete = [];
20452049

20462050
return $this;
20472051
}

0 commit comments

Comments
 (0)