Skip to content

Commit f70a8e6

Browse files
vzabaznovAndrii Lugovyi
authored andcommitted
MAGETWO-36828: Api service should not return custom attribute for catalog inventory
- fix namespace and add set configure through DI
1 parent 00c71ba commit f70a8e6

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

app/code/Magento/Catalog/Model/Plugin/Api/FilterCustomAttribute.php renamed to app/code/Magento/Catalog/Model/Plugin/FilterCustomAttribute.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Copyright © 2015 Magento. All rights reserved.
66
* See COPYING.txt for license details.
77
*/
8-
namespace Magento\Catalog\Model\Plugin\Api;
8+
namespace Magento\Catalog\Model\Plugin;
99

1010
use Magento\Catalog\Model\Product\Attribute\Repository;
1111

@@ -19,13 +19,13 @@ class FilterCustomAttribute
1919
/**
2020
* @param array $blackList
2121
*/
22-
public function __construct($blackList = ['quantity_and_stock_status'])
22+
public function __construct(array $blackList = [])
2323
{
2424
$this->blackList = $blackList;
2525
}
2626

2727
/**
28-
* Delete custom attribute from api response
28+
* Delete custom attribute
2929
*
3030
* @param Repository $repository
3131
* @param array $attributes

app/code/Magento/Catalog/etc/di.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,14 @@
4747
<plugin name="catalogLog" type="Magento\Catalog\Model\Plugin\Log" />
4848
</type>
4949
<type name="Magento\Catalog\Model\Product\Attribute\Repository">
50-
<plugin name="filterDataForApi" type="Magento\Catalog\Model\Plugin\Api\FilterCustomAttribute" />
50+
<plugin name="filterCustomAttribute" type="Magento\Catalog\Model\Plugin\FilterCustomAttribute" />
51+
</type>
52+
<type name="Magento\Catalog\Model\Plugin\FilterCustomAttribute">
53+
<arguments>
54+
<argument name="blackList" xsi:type="array">
55+
<item name="quantity_and_stock_status" xsi:type="string">quantity_and_stock_status</item>
56+
</argument>
57+
</arguments>
5158
</type>
5259
<type name="Magento\Indexer\Model\Indexer\State">
5360
<plugin name="setStatusForIndexer" type="Magento\Catalog\Model\Indexer\Category\Product\Plugin\IndexerState" />

0 commit comments

Comments
 (0)