Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn on edit mode for product repository when adding children #21083

Merged
merged 4 commits into from
Apr 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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