Skip to content

Commit e2621ea

Browse files
committed
ACPT-1316: Fix Sales Webapi GraphQl tests on MTS
1 parent 98fb0dc commit e2621ea

File tree

1 file changed

+11
-1
lines changed
  • app/code/Magento/Eav/Model/Validator/Attribute

1 file changed

+11
-1
lines changed

app/code/Magento/Eav/Model/Validator/Attribute/Data.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
use Magento\Eav\Model\Attribute;
1010
use Magento\Eav\Model\AttributeDataFactory;
11+
use Magento\Eav\Model\Config;
1112
use Magento\Framework\DataObject;
1213

1314
/**
@@ -47,14 +48,22 @@ class Data extends \Magento\Framework\Validator\AbstractValidator
4748
*/
4849
private $ignoredAttributesByTypesList;
4950

51+
/**
52+
* @var \Magento\Eav\Model\Config
53+
*/
54+
private $eavConfig;
55+
5056
/**
5157
* @param AttributeDataFactory $attrDataFactory
5258
* @param array $ignoredAttributesByTypesList
5359
*/
5460
public function __construct(
5561
AttributeDataFactory $attrDataFactory,
62+
Config $eavConfig = null,
5663
array $ignoredAttributesByTypesList = []
5764
) {
65+
$this->eavConfig = $eavConfig ?: \Magento\Framework\App\ObjectManager::getInstance()
66+
->get(Config::class);
5867
$this->_attrDataFactory = $attrDataFactory;
5968
$this->ignoredAttributesByTypesList = $ignoredAttributesByTypesList;
6069
}
@@ -166,8 +175,9 @@ protected function _getAttributes($entity)
166175
} elseif ($entity instanceof \Magento\Framework\Model\AbstractModel &&
167176
$entity->getResource() instanceof \Magento\Eav\Model\Entity\AbstractEntity
168177
) { // $entity is EAV-model
178+
$type = $entity->getEntityType()->getEntityTypeCode();
169179
/** @var \Magento\Eav\Model\Entity\Type $entityType */
170-
$entityType = $entity->getEntityType();
180+
$entityType = $this->eavConfig->getEntityType($type);
171181
$attributes = $entityType->getAttributeCollection()->getItems();
172182

173183
$ignoredTypeAttributes = $this->ignoredAttributesByTypesList[$entityType->getEntityTypeCode()] ?? [];

0 commit comments

Comments
 (0)