Skip to content

Commit 1c7e9f4

Browse files
committed
Merge pull request #112 from magento-api/develop
[API] Sprint 43
2 parents daced02 + a38621a commit 1c7e9f4

File tree

369 files changed

+3674
-2087
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

369 files changed

+3674
-2087
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface ProductLinkManagementInterface
1414
* @param string $productId
1515
* @return \Magento\Bundle\Api\Data\LinkInterface[]
1616
* @throws \Magento\Framework\Exception\NoSuchEntityException
17-
* @throws \Magento\Webapi\Exception
17+
* @throws \Magento\Framework\Exception\InputException
1818
*/
1919
public function getChildren($productId);
2020

@@ -53,7 +53,7 @@ public function addChild(
5353
* @param int $optionId
5454
* @param string $childSku
5555
* @throws \Magento\Framework\Exception\NoSuchEntityException
56-
* @throws \Magento\Webapi\Exception
56+
* @throws \Magento\Framework\Exception\InputException
5757
* @return bool
5858
*/
5959
public function removeChild($productSku, $optionId, $childSku);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface ProductOptionManagementInterface
1414
* @param \Magento\Bundle\Api\Data\OptionInterface $option
1515
* @return int
1616
* @throws \Magento\Framework\Exception\CouldNotSaveException
17-
* @throws \Magento\Webapi\Exception
17+
* @throws \Magento\Framework\Exception\InputException
1818
*/
1919
public function save(\Magento\Bundle\Api\Data\OptionInterface $option);
2020
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ interface ProductOptionRepositoryInterface
1515
* @param int $optionId
1616
* @return \Magento\Bundle\Api\Data\OptionInterface
1717
* @throws \Magento\Framework\Exception\NoSuchEntityException
18-
* @throws \Magento\Webapi\Exception
18+
* @throws \Magento\Framework\Exception\InputException
1919
*/
2020
public function get($productSku, $optionId);
2121

@@ -25,7 +25,7 @@ public function get($productSku, $optionId);
2525
* @param string $productSku
2626
* @return \Magento\Bundle\Api\Data\OptionInterface[]
2727
* @throws \Magento\Framework\Exception\NoSuchEntityException
28-
* @throws \Magento\Webapi\Exception
28+
* @throws \Magento\Framework\Exception\InputException
2929
*/
3030
public function getList($productSku);
3131

@@ -35,7 +35,7 @@ public function getList($productSku);
3535
* @param \Magento\Bundle\Api\Data\OptionInterface $option
3636
* @return bool
3737
* @throws \Magento\Framework\Exception\CouldNotSaveException
38-
* @throws \Magento\Webapi\Exception
38+
* @throws \Magento\Framework\Exception\InputException
3939
*/
4040
public function delete(\Magento\Bundle\Api\Data\OptionInterface $option);
4141

@@ -46,7 +46,7 @@ public function delete(\Magento\Bundle\Api\Data\OptionInterface $option);
4646
* @param int $optionId
4747
* @return bool
4848
* @throws \Magento\Framework\Exception\CouldNotSaveException
49-
* @throws \Magento\Webapi\Exception
49+
* @throws \Magento\Framework\Exception\InputException
5050
*/
5151
public function deleteById($productSku, $optionId);
5252

@@ -57,7 +57,7 @@ public function deleteById($productSku, $optionId);
5757
* @param \Magento\Bundle\Api\Data\OptionInterface $option
5858
* @return int
5959
* @throws \Magento\Framework\Exception\CouldNotSaveException
60-
* @throws \Magento\Webapi\Exception
60+
* @throws \Magento\Framework\Exception\InputException
6161
*/
6262
public function save(
6363
\Magento\Catalog\Api\Data\ProductInterface $product,

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,8 @@ public function getChildren($productId)
7171
{
7272
$product = $this->productRepository->get($productId);
7373
if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) {
74-
throw new \Magento\Webapi\Exception(
75-
'Only implemented for bundle product',
76-
\Magento\Webapi\Exception::HTTP_FORBIDDEN
74+
throw new InputException(
75+
'Only implemented for bundle product'
7776
);
7877
}
7978

@@ -178,9 +177,8 @@ public function removeChild($productSku, $optionId, $childSku)
178177
$product = $this->productRepository->get($productSku);
179178

180179
if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) {
181-
throw new \Magento\Webapi\Exception(
182-
sprintf('Product with specified sku: %s is not a bundle product', $productSku),
183-
\Magento\Webapi\Exception::HTTP_FORBIDDEN
180+
throw new InputException(
181+
sprintf('Product with specified sku: %s is not a bundle product', $productSku)
184182
);
185183
}
186184

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
namespace Magento\Bundle\Model;
88

9-
use Magento\Webapi\Exception;
9+
use Magento\Framework\Exception\InputException;
1010

1111
class OptionManagement implements \Magento\Bundle\Api\ProductOptionManagementInterface
1212
{
@@ -39,7 +39,7 @@ public function save(\Magento\Bundle\Api\Data\OptionInterface $option)
3939
{
4040
$product = $this->productRepository->get($option->getSku());
4141
if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) {
42-
throw new Exception('Only implemented for bundle product', Exception::HTTP_FORBIDDEN);
42+
throw new InputException('Only implemented for bundle product');
4343
}
4444
return $this->optionRepository->save($product, $option);
4545
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
namespace Magento\Bundle\Model;
88

99
use Magento\Framework\Exception\CouldNotSaveException;
10+
use Magento\Framework\Exception\InputException;
1011
use Magento\Framework\Exception\NoSuchEntityException;
11-
use Magento\Webapi\Exception;
1212

1313
/**
1414
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -205,13 +205,13 @@ public function save(
205205
/**
206206
* @param string $productSku
207207
* @return \Magento\Catalog\Api\Data\ProductInterface
208-
* @throws Exception
208+
* @throws \Magento\Framework\Exception\InputException
209209
*/
210210
private function getProduct($productSku)
211211
{
212212
$product = $this->productRepository->get($productSku);
213213
if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) {
214-
throw new Exception('Only implemented for bundle product', Exception::HTTP_FORBIDDEN);
214+
throw new InputException('Only implemented for bundle product');
215215
}
216216
return $product;
217217
}

app/code/Magento/Bundle/composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@
1717
"magento/module-eav": "0.42.0-beta10",
1818
"magento/module-gift-message": "0.42.0-beta10",
1919
"magento/framework": "0.42.0-beta10",
20-
"magento/module-webapi": "0.42.0-beta10",
2120
"magento/module-quote": "0.42.0-beta10",
2221
"magento/magento-composer-installer": "*"
2322
},
23+
"suggest": {
24+
"magento/module-webapi": "0.42.0-beta10"
25+
},
2426
"type": "magento2-module",
2527
"version": "0.42.0-beta10",
2628
"license": [

app/code/Magento/ConfigurableProduct/Api/LinkManagementInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function addChild($productSku, $childSku);
2929
* @param string $productSku
3030
* @param string $childSku
3131
* @throws \Magento\Framework\Exception\NoSuchEntityException
32-
* @throws \Magento\Webapi\Exception
32+
* @throws \Magento\Framework\Exception\InputException
3333
* @return bool
3434
*/
3535
public function removeChild($productSku, $childSku);

app/code/Magento/ConfigurableProduct/Api/OptionRepositoryInterface.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ interface OptionRepositoryInterface
1515
* @param int $optionId
1616
* @return \Magento\ConfigurableProduct\Api\Data\OptionInterface
1717
* @throws \Magento\Framework\Exception\NoSuchEntityException
18-
* @throws \Magento\Webapi\Exception
18+
* @throws \Magento\Framework\Exception\InputException
1919
*/
2020
public function get($productSku, $optionId);
2121

@@ -25,14 +25,14 @@ public function get($productSku, $optionId);
2525
* @param string $productSku
2626
* @return \Magento\ConfigurableProduct\Api\Data\OptionInterface[]
2727
* @throws \Magento\Framework\Exception\NoSuchEntityException
28-
* @throws \Magento\Webapi\Exception
28+
* @throws \Magento\Framework\Exception\InputException
2929
*/
3030
public function getList($productSku);
3131

3232
/**
3333
* Remove option from configurable product
3434
*
35-
* @param Data\OptionInterface $option
35+
* @param \Magento\ConfigurableProduct\Api\Data\OptionInterface $option
3636
* @return bool
3737
*/
3838
public function delete(\Magento\ConfigurableProduct\Api\Data\OptionInterface $option);
@@ -44,7 +44,7 @@ public function delete(\Magento\ConfigurableProduct\Api\Data\OptionInterface $op
4444
* @param int $optionId
4545
* @return bool
4646
* @throws \Magento\Framework\Exception\NoSuchEntityException
47-
* @throws \Magento\Webapi\Exception
47+
* @throws \Magento\Framework\Exception\InputException
4848
*/
4949
public function deleteById($productSku, $optionId);
5050

app/code/Magento/ConfigurableProduct/Api/OptionTypesListInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ interface OptionTypesListInterface
1313
*
1414
* @return string[]
1515
* @throws \Magento\Framework\Exception\NoSuchEntityException
16-
* @throws \Magento\Webapi\Exception
16+
* @throws \Magento\Framework\Exception\InputException
1717
*/
1818
public function getItems();
1919
}

0 commit comments

Comments
 (0)