Skip to content
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

type casted $qty to float in \Magento\Catalog\Model\Product::setQty() #18149

Merged
merged 2 commits into from Oct 3, 2018

Conversation

Projects
None yet
4 participants
@jayankaghosh
Copy link
Contributor

commented Sep 20, 2018

type casted $qty to float in \Magento\Catalog\Model\Product::setQty()

Description

\Magento\Catalog\Model\Product::getQty() should return float/double now, as mentioned in it's Doc-block

Fixed Issues (if relevant)

  1. #18094: Should getQty() return int/float or string?

Manual testing scenarios

  1. Observe any event like checkout_cart_product_add_after
  2. In the Observer, get an instance of \Magento\Catalog\Model\Product
  3. Calling the getQty method of the above-mentioned class would return a float/double instead of string, as expected

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-engcom-team

This comment has been minimized.

Copy link
Contributor

commented Sep 20, 2018

Hi @jayankaghosh. 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

@rogyar

This comment has been minimized.

Copy link
Collaborator

commented Sep 20, 2018

Hi @jayankaghosh. Thank you for your collaboration.
By bringing the change provided in the current PR we only cover cases when the qty is set using setQty method. However, the product model extends AbstractExtensibleModel and qty can be set via setData('qty').
Maybe we should consider the change within a scope of the getter instead of setter

@jayankaghosh

This comment has been minimized.

Copy link
Contributor Author

commented Sep 20, 2018

@rogyar I made changes to the code to type case in the getter, but then the problem is everytime we get the price, type casting will occur, which may affect performance

@magento-engcom-team magento-engcom-team added this to the Release: 2.3.1 milestone Sep 27, 2018

@magento-engcom-team magento-engcom-team merged commit 2ad1031 into magento:2.3-develop Oct 3, 2018

2 of 3 checks passed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
Codacy/PR Quality Review Up to standards. A positive pull request.
Details
licence/cla Contributor License Agreement is signed.
Details

magento-engcom-team pushed a commit that referenced this pull request Oct 3, 2018

@magento-engcom-team

This comment has been minimized.

Copy link
Contributor

commented Oct 3, 2018

Hi @jayankaghosh. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.