Skip to content

Commit c9b43a9

Browse files
committed
ACP2E-156: Merchants can create custom attribute, but it causes an error when trying to save an entity account
- resolve CR comments
1 parent b665f45 commit c9b43a9

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

app/code/Magento/Eav/Setup/EavSetup.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Magento\Eav\Model\Entity\Attribute;
1212
use Magento\Eav\Model\Entity\Setup\Context;
1313
use Magento\Eav\Model\Entity\Setup\PropertyMapperInterface;
14-
use Magento\Eav\Model\ReservedAttributeChecker;
14+
use Magento\Eav\Model\ReservedAttributeCheckerInterface;
1515
use Magento\Eav\Model\ResourceModel\Entity\Attribute\Group\CollectionFactory;
1616
use Magento\Eav\Model\Validator\Attribute\Code;
1717
use Magento\Framework\App\CacheInterface;
@@ -81,7 +81,7 @@ class EavSetup
8181
private $attributeCodeValidator;
8282

8383
/**
84-
* @var ReservedAttributeChecker
84+
* @var ReservedAttributeCheckerInterface
8585
*/
8686
private $reservedAttributeChecker;
8787

@@ -104,7 +104,7 @@ class EavSetup
104104
* @param CollectionFactory $attrGroupCollectionFactory
105105
* @param Code|null $attributeCodeValidator
106106
* @param AddOptionToAttribute|null $addAttributeOption
107-
* @param ReservedAttributeChecker|null $reservedAttributeChecker
107+
* @param ReservedAttributeCheckerInterface|null $reservedAttributeChecker
108108
* @param AttributeFactory|null $attributeFactory
109109
* @param Config|null $eavConfig
110110
* @SuppressWarnings(PHPMD.LongVariable)
@@ -116,7 +116,7 @@ public function __construct(
116116
CollectionFactory $attrGroupCollectionFactory,
117117
Code $attributeCodeValidator = null,
118118
AddOptionToAttribute $addAttributeOption = null,
119-
ReservedAttributeChecker $reservedAttributeChecker = null,
119+
ReservedAttributeCheckerInterface $reservedAttributeChecker = null,
120120
AttributeFactory $attributeFactory = null,
121121
Config $eavConfig = null
122122
) {
@@ -128,7 +128,7 @@ public function __construct(
128128
?? ObjectManager::getInstance()->get(AddOptionToAttribute::class);
129129
$this->attributeCodeValidator = $attributeCodeValidator ?? ObjectManager::getInstance()->get(Code::class);
130130
$this->reservedAttributeChecker = $reservedAttributeChecker
131-
?? ObjectManager::getInstance()->get(ReservedAttributeChecker::class);
131+
?? ObjectManager::getInstance()->get(ReservedAttributeCheckerInterface::class);
132132
$this->attributeFactory = $attributeFactory ?? ObjectManager::getInstance()->get(AttributeFactory::class);
133133
$this->eavConfig = $eavConfig ?? ObjectManager::getInstance()->get(Config::class);
134134
}
@@ -250,6 +250,7 @@ public function addEntityType($code, array $params)
250250
$this->addAttributeSet($code, $this->_defaultAttributeSetName);
251251
}
252252
$this->addAttributeGroup($code, $this->_defaultGroupName, $this->_generalGroupName);
253+
$this->eavConfig->clear();
253254

254255
return $this;
255256
}
@@ -1375,7 +1376,7 @@ public function installEntities($entities = null)
13751376

13761377
foreach ($entities as $entityName => $entity) {
13771378
$this->addEntityType($entityName, $entity);
1378-
$this->eavConfig->clear();
1379+
13791380
$frontendPrefix = isset($entity['frontend_prefix']) ? $entity['frontend_prefix'] : '';
13801381
$backendPrefix = isset($entity['backend_prefix']) ? $entity['backend_prefix'] : '';
13811382
$sourcePrefix = isset($entity['source_prefix']) ? $entity['source_prefix'] : '';

0 commit comments

Comments
 (0)