Skip to content

Commit 249f577

Browse files
committed
MAGETWO-93258: [Forwardport] Optimize retrieving product attributes
1 parent 544ac09 commit 249f577

File tree

5 files changed

+14
-12
lines changed

5 files changed

+14
-12
lines changed

app/code/Magento/CatalogInventory/Model/FilterCustomAttribute.php renamed to app/code/Magento/Catalog/Model/FilterProductCustomAttribute.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
*/
66
namespace Magento\CatalogInventory\Model;
77

8-
class FilterCustomAttribute
8+
/**
9+
* Filter custom attributes for product using the blacklist
10+
*/
11+
class FilterProductCustomAttribute
912
{
1013
/**
1114
* @var array
@@ -22,7 +25,6 @@ public function __construct(array $blackList = [])
2225

2326
/**
2427
* Delete custom attribute
25-
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
2628
* @param array $attributes
2729
* @return mixed
2830
*/

app/code/Magento/Catalog/Model/Product.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Magento\Catalog\Api\Data\ProductInterface;
1111
use Magento\Catalog\Api\ProductLinkRepositoryInterface;
1212
use Magento\Catalog\Model\Product\Attribute\Backend\Media\EntryConverterPool;
13-
use Magento\CatalogInventory\Model\FilterCustomAttribute;
13+
use Magento\CatalogInventory\Model\FilterProductCustomAttribute;
1414
use Magento\Framework\Api\AttributeValueFactory;
1515
use Magento\Framework\App\Filesystem\DirectoryList;
1616
use Magento\Framework\App\ObjectManager;
@@ -349,7 +349,7 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements
349349
*/
350350
private $eavConfig;
351351
/**
352-
* @var FilterCustomAttribute|null
352+
* @var FilterProductCustomAttribute|null
353353
*/
354354
private $filterCustomAttribute;
355355

@@ -390,7 +390,7 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements
390390
* @param \Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface $joinProcessor
391391
* @param array $data
392392
* @param \Magento\Eav\Model\Config|null $config
393-
* @param FilterCustomAttribute|null $filterCustomAttribute
393+
* @param FilterProductCustomAttribute|null $filterCustomAttribute
394394
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
395395
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
396396
*/
@@ -431,7 +431,7 @@ public function __construct(
431431
\Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface $joinProcessor,
432432
array $data = [],
433433
\Magento\Eav\Model\Config $config = null,
434-
FilterCustomAttribute $filterCustomAttribute = null
434+
FilterProductCustomAttribute $filterCustomAttribute = null
435435
) {
436436
$this->metadataService = $metadataService;
437437
$this->_itemOptionFactory = $itemOptionFactory;
@@ -472,7 +472,7 @@ public function __construct(
472472
);
473473
$this->eavConfig = $config ?? ObjectManager::getInstance()->get(\Magento\Eav\Model\Config::class);
474474
$this->filterCustomAttribute = $filterCustomAttribute
475-
?? ObjectManager::getInstance()->get(FilterCustomAttribute::class);
475+
?? ObjectManager::getInstance()->get(FilterProductCustomAttribute::class);
476476
}
477477

478478
/**

app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class ProductTest extends \PHPUnit\Framework\TestCase
8080
protected $_priceInfoMock;
8181

8282
/**
83-
* @var \Magento\CatalogInventory\Model\FilterCustomAttribute|\PHPUnit_Framework_MockObject_MockObject
83+
* @var \Magento\CatalogInventory\Model\FilterProductCustomAttribute|\PHPUnit_Framework_MockObject_MockObject
8484
*/
8585
private $filterCustomAttribute;
8686

@@ -381,7 +381,7 @@ protected function setUp()
381381
->willReturn($this->extensionAttributes);
382382

383383
$this->filterCustomAttribute = $this->createTestProxy(
384-
\Magento\CatalogInventory\Model\FilterCustomAttribute::class
384+
\Magento\CatalogInventory\Model\FilterProductCustomAttribute::class
385385
);
386386

387387
$this->objectManagerHelper = new ObjectManagerHelper($this);

app/code/Magento/CatalogInventory/Model/Plugin/FilterCustomAttribute.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
namespace Magento\CatalogInventory\Model\Plugin;
99

1010
use Magento\Catalog\Model\Product\Attribute\Repository;
11-
use Magento\CatalogInventory\Model\FilterCustomAttribute as Filter;
11+
use Magento\CatalogInventory\Model\FilterProductCustomAttribute as Filter;
1212

1313
class FilterCustomAttribute
1414
{

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
<argument name="filter" xsi:type="object">Magento\CatalogInventory\Model\FilterCustomAttribute</argument>
4141
</arguments>
4242
</type>
43-
<type name="Magento\CatalogInventory\Model\FilterCustomAttribute">
43+
<type name="Magento\Catalog\Model\FilterProductCustomAttribute">
4444
<arguments>
4545
<argument name="blackList" xsi:type="array">
4646
<item name="quantity_and_stock_status" xsi:type="string">quantity_and_stock_status</item>
@@ -82,7 +82,7 @@
8282
</type>
8383
<type name="Magento\Catalog\Model\Product">
8484
<arguments>
85-
<argument name="filter" xsi:type="object">Magento\CatalogInventory\Model\FilterCustomAttribute</argument>
85+
<argument name="filter" xsi:type="object">Magento\Catalog\Model\FilterProductCustomAttribute</argument>
8686
</arguments>
8787
<plugin name="catalogInventoryAfterLoad" type="Magento\CatalogInventory\Model\Plugin\AfterProductLoad"/>
8888
</type>

0 commit comments

Comments
 (0)