Skip to content

Commit f734d7b

Browse files
committed
ACP2E-156: Merchants can create custom attribute, but it causes an error when trying to save an entity account
- resolve code review comments
1 parent 211ee7d commit f734d7b

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

app/code/Magento/Eav/Model/ReservedAttributeChecker.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class ReservedAttributeChecker implements ReservedAttributeCheckerInterface
2626
* @param array $validators
2727
*/
2828
public function __construct(
29-
$validators = []
29+
array $validators = []
3030
) {
3131
$this->validators = $validators;
3232
}
@@ -37,11 +37,6 @@ public function __construct(
3737
public function isReservedAttribute(AbstractAttribute $attribute): bool
3838
{
3939
$isReserved = false;
40-
try {
41-
$attribute->getEntityType();
42-
} catch (LocalizedException $exception) {
43-
$isReserved = false;
44-
}
4540
$validators = $this->validators[$attribute->getEntityType()->getEntityTypeCode()] ?? [];
4641
foreach ($validators as $validator) {
4742
$isReserved = $validator->isReservedAttribute($attribute);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<preference for="Magento\Eav\Model\Entity\Setup\PropertyMapperInterface" type="Magento\Eav\Model\Entity\Setup\PropertyMapper\Composite" />
1010
<preference for="Magento\Eav\Model\Entity\AttributeLoaderInterface" type="Magento\Eav\Model\Entity\AttributeLoader" />
1111
<preference for="Magento\Eav\Model\Entity\Attribute\UniqueValidationInterface" type="Magento\Eav\Model\Entity\Attribute\UniqueValidator" />
12+
<preference for="Magento\Eav\Model\ReservedAttributeCheckerInterface" type="Magento\Eav\Model\ReservedAttributeChecker" />
1213
<preference for="Magento\Eav\Api\Data\AttributeInterface" type="Magento\Eav\Model\Entity\Attribute" />
1314
<preference for="Magento\Eav\Api\AttributeRepositoryInterface" type="Magento\Eav\Model\AttributeRepository" />
1415
<preference for="Magento\Eav\Api\Data\AttributeGroupInterface" type="Magento\Eav\Model\Entity\Attribute\Group" />

0 commit comments

Comments
 (0)