-
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
26827 Added improvements to product attribute repository (save method) #27191
26827 Added improvements to product attribute repository (save method) #27191
Conversation
Hi @sergiy-v. Thank you for your contribution
For more details, please, review the Magento Contributor Guide documentation. |
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.
Hi @sergiy-v . Thank you for the great fix. Please, check my comments below for minor adjustments. Also, it looks like we need to adjust the existing integration tests. Please, check the following report for details
Thank you
|
||
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> | ||
<actionGroup name="AdminAssertProductAttributeByCodeOnProductFormActionGroup"> |
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.
Please, rename the action group as the following example
<actionGroup name="AdminAssertProductAttributeByCodeOnProductFormActionGroup"> | |
<actionGroup name="AssertAdminProductAttributeByCodeOnProductFormActionGroup"> |
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.
Renamed, thanks.
/** | ||
* Performs the conversion of the frontend input value for attribute data | ||
*/ | ||
class SwatchAttributeFrontendInputConversion |
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.
If we are talking about service, I would rename this class. So, the good practice is to start a service name with a verb. By following this practice we will get something like ConvertSwatchAttributeFrontendInput
. What do you think?
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.
You are right, I renamed the class.
The reason why I used such name - I tried to keep the same class name convent (if it's exists) for the module, like: SwatchAttributeCodes, SwatchAttributesProvider, SwatchAttributeType.
…onvert frontend input and add swatch input type for rest area
c9e4f39
to
acfc589
Compare
@rogyar I have added the changes. The functional tests runs with errors at the current moment, but I believe it's not related to the issue/PR. Thanks. |
* | ||
* @return array|null | ||
*/ | ||
public function execute(?array $data): ?array |
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.
I was thinking about the implementation for some time. Must admit that the service should not receive null as the argument since it breaks the implementation consistency. We shall try to be as more specific as possible in the types of accepting/returning in order to make the logic transparent.
From my point of view, if don't have the $data
, we should not call the service. On the other hand, the service should know what's the structure of the data and then make the decision regarding the conversion process. So, let's leave it as it is.
Thank you
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.
Thanks for your thoughts. Just to clarify, in this case this part of the logic was copied from existing logic with unit test which covers the case with NULL for some reason, that's why I decided to leave it as it was.
@sergiy-v could you double-check the fact that the failing tests are not related to your change, please? We have failed tests on creating an attribute with swatch for all 3 instances: Thank you |
I see the same errors for few latest PRs which are not related to swatches, for example: #27246, #27248. Thank you. |
You are right. Most likely they are just fluky tests. |
Hi @rogyar, thank you for the review. |
…atches-improvements
Failed functional tests not related to the changes in this PR. |
Hi @sergiy-v, thank you for your contribution! |
Description
Added improvements to product attribute repository (save method) to convert frontend input and add swatch input type.
Fixed Issues (if relevant)
#26827
Manual testing scenarios
See #26827 issue description for details.
Contribution checklist