Skip to content

[Forwardport] Fix/add expresion #19180

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 3 commits into from
Nov 22, 2018
Merged

[Forwardport] Fix/add expresion #19180

merged 3 commits into from
Nov 22, 2018

Conversation

torhoehn
Copy link
Contributor

@torhoehn torhoehn commented Nov 13, 2018

Original Pull Request

#17915

Title

Fix Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection method addExpressionFieldToSelect result gets overwritten by addFieldToSelect.

Description

Fix Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection method addExpressionFieldToSelect result gets overwriten if called before addFieldToSelect. It happened in _initSelectFields method, if some columns were set before that method call they were overwirtten by it.
I changed the behaviour of addExpressionFieldToSelect method to not modify columns and instead insert expression into _fieldsToSelect private variable (same as addFieldToSelect does).

Fixed Issues (if relevant)

  1. addExpressionFieldToSelect has to be called after all addFieldToSelect #17635: addExpressionFieldToSelect has to be called after all addFieldToSelect

Manual testing scenarios

-create a collection
$bookingCollection = $this->_bookingCollectionFactory->create();
$bookingCollection->addExpressionFieldToSelect('stime_part', 'time(start_time)', []);
$bookingCollection->addFieldToSelect('finish_time', 'finish_date');

Expected result after the fix.
Field 'stime_part' populated with calculated data.

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)

Magently added 3 commits November 13, 2018 07:54
Changed test method to fit the new implementation of the class method
@magento-engcom-team
Copy link
Contributor

Hi @torhoehn. 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 2.3-develop instance - deploy vanilla Magento instance

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

@magento-engcom-team magento-engcom-team added this to the Release: 2.3.1 milestone Nov 13, 2018
@magento-engcom-team
Copy link
Contributor

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

@magento-engcom-team
Copy link
Contributor

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

@torhoehn torhoehn deleted the 2.3-develop-PR-port-17915 branch November 22, 2018 19:56
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.

3 participants