Skip to content

Commit 1cc5d0b

Browse files
author
Spandana Chittimala
committed
Merge remote-tracking branch 'mpi/MAGETWO-99140' into PR-05-29-2019
2 parents 4b2bbc7 + 636a835 commit 1cc5d0b

File tree

2 files changed

+15
-1
lines changed
  • app/code/Magento/Eav

2 files changed

+15
-1
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Magento\Eav\Model\Validator\Attribute;
99

10+
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier;
1011
use Magento\Eav\Model\Entity\Attribute;
1112
use Magento\Framework\Exception\LocalizedException;
1213
use Magento\Framework\Validator\AbstractValidator;
@@ -65,6 +66,16 @@ public function isValid($attributeCode): bool
6566
);
6667
}
6768

69+
/**
70+
* Check attribute_code for prohibited prefix
71+
*/
72+
if (strpos($attributeCode, AbstractModifier::CONTAINER_PREFIX) === 0) {
73+
$errorMessages[] = __(
74+
'"%1" prefix is reserved by the system and cannot be used in attribute code names.',
75+
AbstractModifier::CONTAINER_PREFIX
76+
);
77+
}
78+
6879
$this->_addMessages($errorMessages);
6980

7081
return !$this->hasMessages();

app/code/Magento/Eav/Test/Unit/Model/Validator/Attribute/CodeTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ public function isValidDataProvider(): array
6161
], [
6262
'more_than_60_chars_more_than_60_chars_more_than_60_chars_more',
6363
false
64-
]
64+
], [
65+
'container_attribute',
66+
false,
67+
],
6568
];
6669
}
6770
}

0 commit comments

Comments
 (0)