Skip to content

Commit fc510d3

Browse files
MAGETWO-93424: Permanent Redirect for old URL missing via API or no documentation
1 parent fe93034 commit fc510d3

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

app/code/Magento/CatalogUrlRewrite/Plugin/Webapi/Controller/Rest/InputParamsResolver.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
namespace Magento\CatalogUrlRewrite\Plugin\Webapi\Controller\Rest;
1010

1111
use Magento\Catalog\Api\ProductRepositoryInterface;
12+
use Magento\Catalog\Model\Product;
1213
use Magento\Framework\Webapi\Rest\Request as RestRequest;
1314
use Magento\Webapi\Controller\Rest\InputParamsResolver as InputParamsResolverController;
1415

@@ -52,7 +53,7 @@ public function afterResolve(InputParamsResolverController $subject, array $resu
5253
foreach ($requestBodyParams['product']['custom_attributes'] as $attribute) {
5354
if ($attribute['attribute_code'] === 'save_rewrites_history') {
5455
foreach ($result as $resultItem) {
55-
if ($resultItem instanceof \Magento\Catalog\Model\Product) {
56+
if ($resultItem instanceof Product) {
5657
$resultItem->setData('save_rewrites_history', (bool)$attribute['value']);
5758
break 2;
5859
}

app/code/Magento/CatalogUrlRewrite/Test/Unit/Plugin/Webapi/Controller/Rest/InputParamsResolverTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,9 @@ protected function setUp()
107107

108108
public function testAfterResolve()
109109
{
110-
$this->route->expects($this->once())
111-
->method('getServiceClass')
110+
$this->route->method('getServiceClass')
112111
->willReturn(ProductRepositoryInterface::class);
113-
$this->route->expects($this->once())
114-
->method('getServiceMethod')
112+
$this->route->method('getServiceMethod')
115113
->willReturn('save');
116114
$this->product->expects($this->once())
117115
->method('setData')

0 commit comments

Comments
 (0)