diff --git a/vendor/magento/module-bundle/Model/LinkManagement.php b/vendor/magento/module-bundle/Model/LinkManagement.php index 6adc8cd0fa8bc..56cd1ac093c7f 100644 --- a/vendor/magento/module-bundle/Model/LinkManagement.php +++ b/vendor/magento/module-bundle/Model/LinkManagement.php @@ -252,6 +252,9 @@ private function processLinkedProduct( throw new CouldNotSaveException(__('Could not save child: "%1"', $e->getMessage()), $e); } + $linkedProduct->setId($selectionModel->getId()); + $linkedProduct->setSelectionId($selectionModel->getId()); + $linkedProduct->setOptionId($optionId); return (int)$selectionModel->getId(); } diff --git a/vendor/magento/module-bundle/Model/Option/SaveAction.php b/vendor/magento/module-bundle/Model/Option/SaveAction.php index 2471f932a7545..1219635926a77 100644 --- a/vendor/magento/module-bundle/Model/Option/SaveAction.php +++ b/vendor/magento/module-bundle/Model/Option/SaveAction.php @@ -165,6 +165,8 @@ private function saveOptionItem( /** @var LinkInterface $linkedProduct */ foreach ($linksToAdd as $linkedProduct) { + $linkedProduct->setId(null); + $linkedProduct->setSelectionId(null); $this->linkManagement->addChild($bundleProduct, $option->getOptionId(), $linkedProduct); } } diff --git a/setup/src/Magento/Setup/Model/FixtureGenerator/BundleProductGenerator.php b/setup/src/Magento/Setup/Model/FixtureGenerator/BundleProductGenerator.php index 70501f6f56d74..d3f0d1c3ef685 100644 --- a/setup/src/Magento/Setup/Model/FixtureGenerator/BundleProductGenerator.php +++ b/setup/src/Magento/Setup/Model/FixtureGenerator/BundleProductGenerator.php @@ -1,7 +1,7 @@ sequenceValues[$tableName]) { $connection = $this->resource->getConnection(); - - $this->sequenceValues[$tableName] = $connection->fetchOne( - $connection->select()->from( - $this->resource->getTableName($tableName), - 'MAX(`sequence_value`)' - ) - ); + $entityStatus = $connection->showTableStatus($tableName); + $this->sequenceValues[$tableName] = $entityStatus['Auto_increment']; + return $this->sequenceValues[$tableName]; } return ++$this->sequenceValues[$tableName];