Skip to content

Commit

Permalink
ENGCOM-4754: [Backport] Turn on edit mode for product repository when…
Browse files Browse the repository at this point in the history
… adding children #22295
  • Loading branch information
sidolov authored Apr 18, 2019
2 parents 1c9ea80 + 60a223e commit 2165bb3
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions app/code/Magento/ConfigurableProduct/Model/LinkManagement.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php
/**
*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
Expand All @@ -10,6 +9,11 @@
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\Exception\StateException;

/**
* Configurable product link management.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class LinkManagement implements \Magento\ConfigurableProduct\Api\LinkManagementInterface
{
/**
Expand Down Expand Up @@ -67,7 +71,7 @@ public function __construct(
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getChildren($sku)
{
Expand Down Expand Up @@ -106,11 +110,15 @@ public function getChildren($sku)
}

/**
* {@inheritdoc}
* @inheritdoc
* @throws InputException
* @throws NoSuchEntityException
* @throws StateException
* @throws \Magento\Framework\Exception\CouldNotSaveException
*/
public function addChild($sku, $childSku)
{
$product = $this->productRepository->get($sku);
$product = $this->productRepository->get($sku, true);
$child = $this->productRepository->get($childSku);

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

/**
* {@inheritdoc}
* @inheritdoc
* @throws InputException
* @throws NoSuchEntityException
* @throws StateException
* @throws \Magento\Framework\Exception\CouldNotSaveException
*/
public function removeChild($sku, $childSku)
{
Expand Down

0 comments on commit 2165bb3

Please sign in to comment.