Skip to content

Commit

Permalink
ENGCOM-4188: Turn on edit mode for product repository when adding chi…
Browse files Browse the repository at this point in the history
…ldren #21083
  • Loading branch information
sidolov authored Apr 10, 2019
2 parents e19411b + 6a41261 commit 9d06979
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 @@ -11,6 +10,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 @@ -68,7 +72,7 @@ public function __construct(
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getChildren($sku)
{
Expand Down Expand Up @@ -107,11 +111,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 @@ -150,7 +158,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 9d06979

Please sign in to comment.