Skip to content

[2.3] Product image builder - Override attributes when builder used multiple times #13439

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

Conversation

ihor-sviziev
Copy link
Contributor

Description

Backport of #13438 to 2.3-develop branch.

Image builder is used few times with different parameters in \Magento\Catalog\Block\Product\AbstractProduct::getImage.
In case when on first call $attributes was set to not empty array, on second call - $attributes is empty array - builder re-used attributes from first call, as result - we will get unexpected result - attributes will be re-used from 1st call.

$this->imageBuilder->setProduct($product)
    ->setImageId($imageId)
    ->setAttributes($attributes)
    ->create();

As builder designed to be used multiple times - let's remove check that attributes array is not empty.

Fixed Issues (if relevant)

N/A

Manual testing scenarios

See description

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 Jan 31, 2018

CLA assistant check
All committers have signed the CLA.

@ihor-sviziev ihor-sviziev changed the base branch from 2.2-develop to 2.3-develop January 31, 2018 08:27
@ihor-sviziev ihor-sviziev reopened this Jan 31, 2018
…e times

Extract test data with and without attributes to separate methods

(cherry picked from commit 775ec3a)
@ihor-sviziev ihor-sviziev reopened this Feb 16, 2018
@ihor-sviziev ihor-sviziev requested a review from rogyar February 16, 2018 14:36
@rogyar rogyar self-assigned this Feb 17, 2018
@magento-engcom-team magento-engcom-team added this to the February 2018 milestone Feb 17, 2018
@magento-engcom-team magento-engcom-team merged commit 2ad1f52 into magento:2.3-develop Feb 26, 2018
magento-engcom-team pushed a commit that referenced this pull request Feb 26, 2018
@ihor-sviziev ihor-sviziev deleted the 2.3-product-image-builder-fix-issue-with-set-attributes branch February 27, 2018 03:36
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.

4 participants