-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
change error to code is reserved key instead of code already exists #28663
change error to code is reserved key instead of code already exists #28663
Conversation
Hi @AbdulRahmanAbouzaid. Thank you for your contribution
❗ Automated tests can be triggered manually with an appropriate comment:
You can find more information about the builds here ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review. For more details, please, review the Magento Contributor Guide documentation. |
@magento run all tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move reserved attributes to the private constant.
Please consider covering this change with MFTF test.
@lenaorobei changes and test provided. Can you please review it again? |
@magento run all tests |
@magento run all tests |
@magento run Functional Tests CE |
: __('An attribute with the same code (%1) already exists.', $attributeCode); | ||
|
||
if ($attribute->getId() && !$attributeId || in_array($attributeCode, static::RESERVED_CODES)) { | ||
if (in_array($attributeCode, static::RESERVED_CODES)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's simplify logic in this condition. The same in_array
is being called twice.
Please use self
instead of static
for constant access.
@magento run all tests |
@lenaorobei Changes provided |
@magento run Functional Tests B2B, Functional Tests CE, Functional Tests EE |
@magento run all tests |
@engcom-Alfa phrase added to the translation file |
✔️ QA Passed Manual testing scenario:
Before: ✖️ Either of following messages appear After: ✔️ Attribute is not saved. Error message is shown ✔️ text: Code " ✔️ text: Code " |
@magento run all tests |
@magento run all tests |
Hi @AbdulRahmanAbouzaid, thank you for your contribution! |
Description (*)
Change error message caused by creating product attribute with
product_type
andtype_id
codes to be more descriptive.Fixed Issues (if relevant)
Manual testing scenarios (*)
Stores
>Attributes
>Product
product_type
ortype_id
codeQuestions or comments
Contribution checklist (*)