Skip to content

Commit 9d06979

Browse files
authored
ENGCOM-4188: Turn on edit mode for product repository when adding children #21083
2 parents e19411b + 6a41261 commit 9d06979

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
*/
@@ -11,6 +10,11 @@
1110
use Magento\Framework\Exception\NoSuchEntityException;
1211
use Magento\Framework\Exception\StateException;
1312

13+
/**
14+
* Configurable product link management.
15+
*
16+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
17+
*/
1418
class LinkManagement implements \Magento\ConfigurableProduct\Api\LinkManagementInterface
1519
{
1620
/**
@@ -68,7 +72,7 @@ public function __construct(
6872
}
6973

7074
/**
71-
* {@inheritdoc}
75+
* @inheritdoc
7276
*/
7377
public function getChildren($sku)
7478
{
@@ -107,11 +111,15 @@ public function getChildren($sku)
107111
}
108112

109113
/**
110-
* {@inheritdoc}
114+
* @inheritdoc
115+
* @throws InputException
116+
* @throws NoSuchEntityException
117+
* @throws StateException
118+
* @throws \Magento\Framework\Exception\CouldNotSaveException
111119
*/
112120
public function addChild($sku, $childSku)
113121
{
114-
$product = $this->productRepository->get($sku);
122+
$product = $this->productRepository->get($sku, true);
115123
$child = $this->productRepository->get($childSku);
116124

117125
$childrenIds = array_values($this->configurableType->getChildrenIds($product->getId())[0]);
@@ -150,7 +158,11 @@ public function addChild($sku, $childSku)
150158
}
151159

152160
/**
153-
* {@inheritdoc}
161+
* @inheritdoc
162+
* @throws InputException
163+
* @throws NoSuchEntityException
164+
* @throws StateException
165+
* @throws \Magento\Framework\Exception\CouldNotSaveException
154166
*/
155167
public function removeChild($sku, $childSku)
156168
{

0 commit comments

Comments
 (0)