[Forwardport] Improvement: Magento\Sales\Helper\Guest refactoring and bugfix #11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Original Pull Request
magento#12893
Dear Magento2,
This PR consists of several improvements and bug fixes. The main goal of it is to increase performance and logic side of the Magento\Sales\Helper\Guest. Please, review Description section for more information.
Looking forward to your reply,
Alex
Description
The main improvements here are in the
Magento\Sales\Helper\Guest::getOrderRecord($incrementId)
Added
store_id
as filter to search criteria to improve logic/performance and due to this fact theMagento\Sales\Helper\Guest::validateOrderStoreId($orderStoreId)
can be removed.Replaced
with
This allows Magento to reduce the number of database queries because every time when the
getTotalCount()
is called it initiates thegetSize()
method which checks the$this->_totalRecords
value but in this case it equals tonull
every new call because every new call begins after page load.Moved
$this->hasPostDataEmptyFields($post)
to ternary operator because this is good to have all conditions according to order in one place.Fixed typo
compareSoredBillingDataWithInput
tocompareStoredBillingDataWithInput
Removed underscore
private $_storeManager;
toprivate $storeManager;
(PSR-2: Property names SHOULD NOT be prefixed with a single underscore to indicate protected or private visibility.)Fixed Issues (if relevant)
No relevant issue.
Manual testing scenarios
Those changes didn't change business logic. Only code improvement and, as a result, no manual testing scenarios.
Contribution checklist