Skip to content

Commit 55841eb

Browse files
author
Yu Tang
committed
MAGETWO-28256: Bundle Integration API Refactoring
- Change parameter name to be consistent
1 parent 9a0c65c commit 55841eb

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

app/code/Magento/Bundle/Api/ProductLinkManagementInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ public function getChildren($productSku, $optionId = null);
3333
public function addChildByProductSku($sku, $optionId, \Magento\Bundle\Api\Data\LinkInterface $linkedProduct);
3434

3535
/**
36-
* @param string $productSku
36+
* @param string $sku
3737
* @param \Magento\Bundle\Api\Data\LinkInterface $linkedProduct
3838
* @throws \Magento\Framework\Exception\NoSuchEntityException
3939
* @throws \Magento\Framework\Exception\CouldNotSaveException
4040
* @throws \Magento\Framework\Exception\InputException
4141
* @return bool
4242
*/
4343
public function saveChild(
44-
$productSku,
44+
$sku,
4545
\Magento\Bundle\Api\Data\LinkInterface $linkedProduct
4646
);
4747

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@ public function addChildByProductSku($sku, $optionId, \Magento\Bundle\Api\Data\L
111111
* @SuppressWarnings(PHPMD.NPathComplexity)
112112
*/
113113
public function saveChild(
114-
$productSku,
114+
$sku,
115115
\Magento\Bundle\Api\Data\LinkInterface $linkedProduct
116116
) {
117-
$product = $this->productRepository->get($productSku);
117+
$product = $this->productRepository->get($sku);
118118
if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) {
119119
throw new InputException(
120120
__('Product with specified sku: "%1" is not a bundle product', [$product->getSku()])

app/code/Magento/Bundle/etc/webapi.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<resource ref="Magento_Catalog::products"/>
1414
</resources>
1515
</route>
16-
<route url="/V1/bundle-products/:productSku/links/:id" method="PUT">
16+
<route url="/V1/bundle-products/:sku/links/:id" method="PUT">
1717
<service class="Magento\Bundle\Api\ProductLinkManagementInterface" method="saveChild"/>
1818
<resources>
1919
<resource ref="Magento_Catalog::products"/>

dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductLinkManagementTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@ public function testSaveChild()
111111
*/
112112
private function saveChild($productSku, $linkedProduct)
113113
{
114-
$resourcePath = self::RESOURCE_PATH . '/:productSku/links/:id';
114+
$resourcePath = self::RESOURCE_PATH . '/:sku/links/:id';
115115
$serviceInfo = [
116116
'rest' => [
117117
'resourcePath' => str_replace(
118-
[':productSku', ':id'],
118+
[':sku', ':id'],
119119
[$productSku, $linkedProduct['id']],
120120
$resourcePath
121121
),
@@ -129,7 +129,7 @@ private function saveChild($productSku, $linkedProduct)
129129
];
130130
return $this->_webApiCall(
131131
$serviceInfo,
132-
['productSku' => $productSku, 'linkedProduct' => $linkedProduct]
132+
['sku' => $productSku, 'linkedProduct' => $linkedProduct]
133133
);
134134
}
135135

0 commit comments

Comments
 (0)