Skip to content

Commit c33e582

Browse files
committed
Merge remote-tracking branch 'perf/MC-34073-deadlock' into MC-33400-cart-addorderitem-improvement
2 parents ede8e71 + 85fee12 commit c33e582

File tree

1 file changed

+10
-10
lines changed
  • app/code/Magento/Bundle/Model/ResourceModel

1 file changed

+10
-10
lines changed

app/code/Magento/Bundle/Model/ResourceModel/Option.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,29 +92,29 @@ protected function _afterSave(AbstractModel $object)
9292
{
9393
parent::_afterSave($object);
9494

95-
$condition = [
96-
'option_id = ?' => $object->getId(),
97-
'store_id = ? OR store_id = 0' => $object->getStoreId(),
98-
'parent_product_id = ?' => $object->getParentId()
99-
];
100-
10195
$connection = $this->getConnection();
102-
$connection->delete($this->getTable('catalog_product_bundle_option_value'), $condition);
103-
10496
$data = new DataObject();
10597
$data->setOptionId($object->getId())
10698
->setStoreId($object->getStoreId())
10799
->setParentProductId($object->getParentId())
108100
->setTitle($object->getTitle());
109101

110-
$connection->insert($this->getTable('catalog_product_bundle_option_value'), $data->getData());
102+
$connection->insertOnDuplicate(
103+
$this->getTable('catalog_product_bundle_option_value'),
104+
$data->getData(),
105+
['title']
106+
);
111107

112108
/**
113109
* also saving default fallback value
114110
*/
115111
if (0 !== (int)$object->getStoreId()) {
116112
$data->setStoreId(0)->setTitle($object->getDefaultTitle());
117-
$connection->insert($this->getTable('catalog_product_bundle_option_value'), $data->getData());
113+
$connection->insertOnDuplicate(
114+
$this->getTable('catalog_product_bundle_option_value'),
115+
$data->getData(),
116+
['title']
117+
);
118118
}
119119

120120
return $this;

0 commit comments

Comments
 (0)