|
21 | 21 | * @method int setSearchWeight(int $value)
|
22 | 22 | * @method bool getIsUsedForPriceRules()
|
23 | 23 | * @method int setIsUsedForPriceRules(int $value)
|
24 |
| - * @method \Magento\Eav\Api\Data\AttributeExtensionInterface getExtensionAttributes() |
25 | 24 | *
|
26 | 25 | * @author Magento Core Team <core@magentocommerce.com>
|
27 | 26 | * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
@@ -80,6 +79,11 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute implements
|
80 | 79 | */
|
81 | 80 | protected $_indexerEavProcessor;
|
82 | 81 |
|
| 82 | + /** |
| 83 | + * @var \Magento\Eav\Api\Data\AttributeExtensionFactory |
| 84 | + */ |
| 85 | + private $eavAttributeFactory; |
| 86 | + |
83 | 87 | /**
|
84 | 88 | * @param \Magento\Framework\Model\Context $context
|
85 | 89 | * @param \Magento\Framework\Registry $registry
|
@@ -129,12 +133,15 @@ public function __construct(
|
129 | 133 | LockValidatorInterface $lockValidator,
|
130 | 134 | \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
|
131 | 135 | \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
|
| 136 | + \Magento\Eav\Api\Data\AttributeExtensionFactory $eavAttributeFactory = null, |
132 | 137 | array $data = []
|
133 | 138 | ) {
|
134 | 139 | $this->_indexerEavProcessor = $indexerEavProcessor;
|
135 | 140 | $this->_productFlatIndexerProcessor = $productFlatIndexerProcessor;
|
136 | 141 | $this->_productFlatIndexerHelper = $productFlatIndexerHelper;
|
137 | 142 | $this->attrLockValidator = $lockValidator;
|
| 143 | + $this->eavAttributeFactory = $eavAttributeFactory ?: \Magento\Framework\App\ObjectManager::getInstance() |
| 144 | + ->get(\Magento\Eav\Api\Data\AttributeExtensionFactory::class); |
138 | 145 | parent::__construct(
|
139 | 146 | $context,
|
140 | 147 | $registry,
|
@@ -887,4 +894,18 @@ public function setIsFilterableInGrid($isFilterableInGrid)
|
887 | 894 | $this->setData(self::IS_FILTERABLE_IN_GRID, $isFilterableInGrid);
|
888 | 895 | return $this;
|
889 | 896 | }
|
| 897 | + |
| 898 | + /** |
| 899 | + * @return \Magento\Eav\Api\Data\AttributeExtensionInterface |
| 900 | + */ |
| 901 | + public function getExtensionAttributes() |
| 902 | + { |
| 903 | + $extensionAttributes = $this->_getExtensionAttributes(); |
| 904 | + if (null === $extensionAttributes) { |
| 905 | + /** @var \Magento\Eav\Api\Data\AttributeExtensionInterface $extensionAttributes */ |
| 906 | + $extensionAttributes = $this->eavAttributeFactory->create(); |
| 907 | + $this->setExtensionAttributes($extensionAttributes); |
| 908 | + } |
| 909 | + return $extensionAttributes; |
| 910 | + } |
890 | 911 | }
|
0 commit comments