Skip to content

Fix of saving "clone_field" fields #18160

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

Merged
merged 1 commit into from
Oct 16, 2018
Merged

Fix of saving "clone_field" fields #18160

merged 1 commit into from
Oct 16, 2018

Conversation

jbrada
Copy link
Member

@jbrada jbrada commented Sep 20, 2018

Description

After the Config model's refactoring, which came with released version 2.2.6, there was an error in storing the fileds which were created using "clone_field" feature. When the values were stored, the path was wrong and the values were stored under the wrong key.

E.g. when saving Product Image Placeholders.
Instead of expected values catalog/placeholder/image_placeholder, catalog/placeholder/ small_image_placeholder, catalog/placeholder/swatch_image_placeholder and catalog/placeholder/thumbnail_placeholder, all fields were saved to the catalog/placeholder/ placeholder.

Manual testing scenarios

  1. Configuration -> Catalog -> Catalog
  2. Open Product Image Placeholders tab
  3. Upload an image
  4. Save
  5. "Saved" image is missing after page load.

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Sep 20, 2018

CLA assistant check
All committers have signed the CLA.

@magento-engcom-team
Copy link
Contributor

Hi @higi90. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me $VERSION instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

* @param array &$oldConfig Need for compatibility with _processGroup()
* @param array &$extraOldGroups Need for compatibility with _processGroup()
* @return string
*/
private function getFieldPath(Field $field, array &$oldConfig, array &$extraOldGroups): string
private function getFieldPath(Field $field, string $fieldId, array &$oldConfig, array &$extraOldGroups): string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that changing parameters order and adding a new parameter in the middle of the sequence a good idea. Current implementation will broke all usages of getFieldPath method because array will be passed as second parameter instead of string.

Copy link
Member Author

@jbrada jbrada Sep 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, I agree with you. But in this case I think i can change the order of the parameters as I did because it is a private method. If it were anything else (protected or public) changing parameters order is of course, unacceptable. There are only 2 usages of the getFieldPath method in Magento/Config/Model/Config and I replaced them in the commit.

@magento-engcom-team
Copy link
Contributor

Hi @sidolov, thank you for the review.
ENGCOM-3060 has been created to process this Pull Request

@magento-engcom-team
Copy link
Contributor

@higi90 thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository.

@magento-engcom-team magento-engcom-team merged commit 6a1feed into magento:2.3-develop Oct 16, 2018
@magento-engcom-team
Copy link
Contributor

Hi @higi90. Thank you for your contribution.
We will aim to release these changes as part of 2.3.1.
Please check the release notes for final confirmation.

@davoc
Copy link

davoc commented Dec 6, 2018

Thanks - this fix worked for us in v2.2.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants