Skip to content

Commit c68784d

Browse files
author
Magento CICD
authored
MAGETWO-64709: [GitHub] [PR] Product->save() shouldn't be called directly #8498
2 parents 50d57a0 + a0a962f commit c68784d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/code/Magento/Catalog/Model/ProductWebsiteLinkRepository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function save(ProductWebsiteLinkInterface $productWebsiteLink)
3737
$product = $this->productRepository->get($productWebsiteLink->getSku());
3838
$product->setWebsiteIds(array_merge($product->getWebsiteIds(), [$productWebsiteLink->getWebsiteId()]));
3939
try {
40-
$product->save();
40+
$this->productRepository->save($product);
4141
} catch (\Exception $e) {
4242
throw new CouldNotSaveException(
4343
__(
@@ -68,7 +68,7 @@ public function deleteById($sku, $websiteId)
6868
$product->setWebsiteIds(array_diff($product->getWebsiteIds(), [$websiteId]));
6969

7070
try {
71-
$product->save();
71+
$this->productRepository->save($product);
7272
} catch (\Exception $e) {
7373
throw new CouldNotSaveException(
7474
__(

0 commit comments

Comments
 (0)