Skip to content

Commit fad31c6

Browse files
author
Shikha Mishra
authored
Updated AbstractMassaction.php
1 parent 77670fa commit fad31c6

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
use Magento\Backend\Block\Widget\Grid\Massaction\VisibilityCheckerInterface as VisibilityChecker;
1010
use Magento\Framework\DataObject;
11+
use Magento\Framework\Data\Collection\AbstractDb;
1112

1213
/**
1314
* Grid widget massaction block
@@ -277,16 +278,19 @@ public function getGridIdsJson()
277278
}
278279
/** @var \Magento\Framework\Data\Collection $allIdsCollection */
279280
$allIdsCollection = clone $this->getParentBlock()->getCollection();
281+
280282
if ($this->getMassactionIdField()) {
281283
$massActionIdField = $this->getMassactionIdField();
282284
} else {
283285
$massActionIdField = $this->getParentBlock()->getMassactionIdField();
284286
}
285-
$allIdsCollection = clone $allIdsCollection->getSelect();
286-
$allIdsCollection->reset(\Magento\Framework\DB\Select::LIMIT_COUNT);
287-
$allIdsCollection->columns($massActionIdField, 'main_table');
288-
$resourse = \Magento\Framework\App\ObjectManager::getInstance()->create('Magento\Framework\App\ResourceConnection');
289-
$gridIds = $resourse->getConnection()->fetchCol($allIdsCollection);
287+
288+
if ($allIdsCollection instanceof AbstractDb) {
289+
$allIdsCollection->getSelect()->limit();
290+
$allIdsCollection->clear();
291+
}
292+
293+
$gridIds = $allIdsCollection->setPageSize(0)->getColumnValues($massActionIdField);
290294
if (!empty($gridIds)) {
291295
return join(",", $gridIds);
292296
}

0 commit comments

Comments
 (0)