Skip to content

Commit 643ea4f

Browse files
p-bystritskyDen4ik
authored andcommitted
#21200: Fulltext collection size fix.
1 parent 2b11ea6 commit 643ea4f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

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

Lines changed: 8 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
}
@@ -364,11 +365,14 @@ protected function _renderFilters()
364365

365366
/**
366367
* Hook for operations before rendering filters
368+
*
369+
* phpcs:disable Magento2.CodeAnalysis.EmptyBlock
367370
* @return void
368371
*/
369372
protected function _renderFiltersBefore()
370373
{
371374
}
375+
// phpcs:enable
372376

373377
/**
374378
* Add field filter to collection
@@ -727,6 +731,7 @@ public function loadData($printQuery = false, $logQuery = false)
727731
public function printLogQuery($printQuery = false, $logQuery = false, $sql = null)
728732
{
729733
if ($printQuery || $this->getFlag('print_query')) {
734+
// phpcs:ignore Magento2.Security.LanguageConstruct
730735
echo $sql === null ? $this->getSelect()->__toString() : $sql;
731736
}
732737

@@ -819,11 +824,13 @@ public function __clone()
819824
* Init select
820825
*
821826
* @return void
827+
* phpcs:disable Magento2.CodeAnalysis.EmptyBlock
822828
*/
823829
protected function _initSelect()
824830
{
825831
// no implementation, should be overridden in children classes
826832
}
833+
// phpcs:enable
827834

828835
/**
829836
* Join extension attribute.

0 commit comments

Comments
 (0)