Skip to content

Commit 2165bb3

Browse files
authored
ENGCOM-4754: [Backport] Turn on edit mode for product repository when adding children #22295
2 parents 1c9ea80 + 60a223e commit 2165bb3

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

app/code/Magento/ConfigurableProduct/Model/LinkManagement.php

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22
/**
3-
*
43
* Copyright © Magento, Inc. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
@@ -10,6 +9,11 @@
109
use Magento\Framework\Exception\NoSuchEntityException;
1110
use Magento\Framework\Exception\StateException;
1211

12+
/**
13+
* Configurable product link management.
14+
*
15+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
16+
*/
1317
class LinkManagement implements \Magento\ConfigurableProduct\Api\LinkManagementInterface
1418
{
1519
/**
@@ -67,7 +71,7 @@ public function __construct(
6771
}
6872

6973
/**
70-
* {@inheritdoc}
74+
* @inheritdoc
7175
*/
7276
public function getChildren($sku)
7377
{
@@ -106,11 +110,15 @@ public function getChildren($sku)
106110
}
107111

108112
/**
109-
* {@inheritdoc}
113+
* @inheritdoc
114+
* @throws InputException
115+
* @throws NoSuchEntityException
116+
* @throws StateException
117+
* @throws \Magento\Framework\Exception\CouldNotSaveException
110118
*/
111119
public function addChild($sku, $childSku)
112120
{
113-
$product = $this->productRepository->get($sku);
121+
$product = $this->productRepository->get($sku, true);
114122
$child = $this->productRepository->get($childSku);
115123

116124
$childrenIds = array_values($this->configurableType->getChildrenIds($product->getId())[0]);
@@ -144,7 +152,11 @@ public function addChild($sku, $childSku)
144152
}
145153

146154
/**
147-
* {@inheritdoc}
155+
* @inheritdoc
156+
* @throws InputException
157+
* @throws NoSuchEntityException
158+
* @throws StateException
159+
* @throws \Magento\Framework\Exception\CouldNotSaveException
148160
*/
149161
public function removeChild($sku, $childSku)
150162
{

0 commit comments

Comments
 (0)