-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Fix/add expresion #17915
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
Fix/add expresion #17915
Conversation
…n by addFieldToSelect()
Changed test method to fit the new implementation of the class method
|
Hi @magently. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
|
Hi @magently , please, update the PR with the issue description and steps to reproduce, otherwise, we can't proceed with your PR. |
|
Sorry about the description, i was certain i filled it before. Updated |
|
Hi @slavvka, thank you for the review. |
|
Hi @magently. Thank you for your contribution. Please, consider to port this solution to 2.3 release line. |
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)
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