Skip to content

Commit 08ab509

Browse files
committed
Refactor: move interface attributes array to interface itself
1 parent d1ebc31 commit 08ab509

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

app/code/Magento/Catalog/Api/Data/ProductInterface.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,24 @@ interface ProductInterface extends \Magento\Framework\Api\CustomAttributesDataIn
3636

3737
const UPDATED_AT = 'updated_at';
3838

39+
const MEDIA_GALLERY = 'media_gallery';
40+
41+
const TIER_PRICE = 'tier_price';
42+
43+
const ATTRIBUTES = [
44+
self::SKU,
45+
self::NAME,
46+
self::PRICE,
47+
self::WEIGHT,
48+
self::STATUS,
49+
self::VISIBILITY,
50+
self::ATTRIBUTE_SET_ID,
51+
self::TYPE_ID,
52+
self::CREATED_AT,
53+
self::UPDATED_AT,
54+
self::MEDIA_GALLERY,
55+
self::TIER_PRICE,
56+
];
3957
/**#@-*/
4058

4159
/**

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

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -305,22 +305,12 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements
305305

306306
/**
307307
* List of attributes in ProductInterface
308+
*
309+
* @deprecated
310+
* @see ProductInterface::ATTRIBUTES
308311
* @var array
309312
*/
310-
protected $interfaceAttributes = [
311-
ProductInterface::SKU,
312-
ProductInterface::NAME,
313-
ProductInterface::PRICE,
314-
ProductInterface::WEIGHT,
315-
ProductInterface::STATUS,
316-
ProductInterface::VISIBILITY,
317-
ProductInterface::ATTRIBUTE_SET_ID,
318-
ProductInterface::TYPE_ID,
319-
ProductInterface::CREATED_AT,
320-
ProductInterface::UPDATED_AT,
321-
'media_gallery',
322-
'tier_price',
323-
];
313+
protected $interfaceAttributes = ProductInterface::ATTRIBUTES;
324314

325315
/**
326316
* @var \Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface
@@ -480,7 +470,7 @@ protected function getCustomAttributesCodes()
480470
{
481471
if ($this->customAttributesCodes === null) {
482472
$this->customAttributesCodes = $this->getEavAttributesCodes($this->metadataService);
483-
$this->customAttributesCodes = array_diff($this->customAttributesCodes, $this->interfaceAttributes);
473+
$this->customAttributesCodes = array_diff($this->customAttributesCodes, ProductInterface::ATTRIBUTES);
484474
}
485475
return $this->customAttributesCodes;
486476
}

0 commit comments

Comments
 (0)