-
Notifications
You must be signed in to change notification settings - Fork 9.4k
magento/magento2#39111: Product Collection - addMediaGalleryData call… #39681
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
magento/magento2#39111: Product Collection - addMediaGalleryData call… #39681
Conversation
… when the collection maybe or will be loaded (Can use count to avoid an extra DB query) - Fixed call count instead of getSize if collection is loaded.
|
Hi @Himsoft. Thank you for your contribution!
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
|
@magento run all tests |
… when the collection maybe or will be loaded (Can use count to avoid an extra DB query) - Fixed call count instead of getSize if collection is loaded.
|
@magento run all tests |
|
@magento run all tests |
… when the collection maybe or will be loaded (Can use count to avoid an extra DB query) - Fixed call count instead of getSize if collection is loaded.
|
@magento run all tests |
|
The failed tests are not related to fixes, they look like false positives, please pay attention to this during the review. |
|
@magento run all tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot wasn't able to review any files in this pull request.
Files not reviewed (2)
- app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php: Language not supported
- app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/CollectionTest.php: Language not supported
engcom-Hotel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @Himsoft,
Thanks for the contribution!
The changes looks good to me, just one change as suggested below.
| /** | ||
| * Copyright © Magento, Inc. All rights reserved. | ||
| * See COPYING.txt for license details. | ||
| * Copyright 2025 Adobe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This must be 2015, as the file created in this year only.
… when the collection maybe or will be loaded (Can use count to avoid an extra DB query) - Fixed call count instead of getSize if collection is loaded.
|
@magento run all tests |
|
@magento run all tests |
|
@Himsoft Thank you for contribution & collaboration! ✔️ QA Passed Preconditions: Steps to reproduce:
Before: As per PR description getSize() was getting called on already loaded collection which was increasing the call trace with one more query. After: Count() function is called if the collection is already loaded. only one trace found for addMediaGalleryData. Added Loggers in the code to check is count getting called or not as the call was not there in the db.log Functional Tests are failing hence moving this PR to Extended Testing. |
|
@magento run Functional Tests B2B, Functional Tests CE, Functional Tests EE |
5388de0
into
magento:2.4-develop






Description (*)
\Magento\Catalog\Model\ResourceModel\Product\Collection::addMediaGalleryData calls getSize if the collection is loaded.
Related Pull Requests
Fixed Issues (if relevant)
Manual testing scenarios (*)
Before fix:
getSize is called on a loaded product collection
After fix:
count is called on a loaded product collection
Questions or comments
Contribution checklist (*)