Skip to content

Commit 9e491a6

Browse files
committed
#21200: Fulltext collection size fix.
1 parent f72f74d commit 9e491a6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/internal/Magento/Framework/Data/Collection/AbstractDb.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
/**
1717
* Base items collection class
1818
*
19+
* phpcs:disable Magento2.Classes.AbstractApi
1920
* @api
2021
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2122
*/
@@ -217,7 +218,7 @@ public function getSize()
217218
{
218219
if ($this->_totalRecords === null) {
219220
$sql = $this->getSelectCountSql();
220-
$this->_totalRecords = $this->getConnection()->fetchOne($sql, $this->_bindParams);
221+
$this->_totalRecords = $this->_totalRecords ?? $this->getConnection()->fetchOne($sql, $this->_bindParams);
221222
}
222223
return (int)$this->_totalRecords;
223224
}
@@ -367,10 +368,12 @@ protected function _renderFilters()
367368
* Hook for operations before rendering filters
368369
*
369370
* @return void
371+
* phpcs:disable Magento2.CodeAnalysis.EmptyBlock
370372
*/
371373
protected function _renderFiltersBefore()
372374
{
373375
}
376+
// phpcs:enable
374377

375378
/**
376379
* Add field filter to collection
@@ -730,6 +733,7 @@ public function loadData($printQuery = false, $logQuery = false)
730733
public function printLogQuery($printQuery = false, $logQuery = false, $sql = null)
731734
{
732735
if ($printQuery || $this->getFlag('print_query')) {
736+
// phpcs:ignore Magento2.Security.LanguageConstruct
733737
echo $sql === null ? $this->getSelect()->__toString() : $sql;
734738
}
735739

@@ -822,11 +826,13 @@ public function __clone()
822826
* Init select
823827
*
824828
* @return void
829+
* phpcs:disable Magento2.CodeAnalysis.EmptyBlock
825830
*/
826831
protected function _initSelect()
827832
{
828833
// no implementation, should be overridden in children classes
829834
}
835+
// phpcs:enable
830836

831837
/**
832838
* Join extension attribute.

0 commit comments

Comments
 (0)