Skip to content

Commit 072a3fe

Browse files
author
Ihor Kh
committed
#39111: Product Collection - addMediaGalleryData calls getSize 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.
1 parent 89b4e2e commit 072a3fe

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2362,7 +2362,9 @@ public function addMediaGalleryData()
23622362
return $this;
23632363
}
23642364

2365-
if (!$this->getSize()) {
2365+
$size = $this->isLoaded() ? $this->count() : $this->getSize();
2366+
2367+
if (!$size) {
23662368
return $this;
23672369
}
23682370

0 commit comments

Comments
 (0)