Skip to content

Commit 48da96d

Browse files
author
Michael Yu
committed
MAGETWO-71415 [The system grids] Mass actions process only 20 elements from all selected
- Utilize built in function on dataProvider to produce the same outcome.
1 parent 0bca27c commit 48da96d

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

app/code/Magento/Customer/Controller/Adminhtml/Index/AbstractMassAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function __construct(Context $context, Filter $filter, CollectionFactory
6161
public function execute()
6262
{
6363
try {
64-
$collection = $this->filter->getCollection($this->collectionFactory->create(), false);
64+
$collection = $this->filter->getCollection($this->collectionFactory->create());
6565
return $this->massAction($collection);
6666
} catch (\Exception $e) {
6767
$this->messageManager->addError($e->getMessage());

app/code/Magento/Ui/Component/MassAction/Filter.php

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,10 @@ public function getComponent()
8282
* Adds filters to collection using DataProvider filter results
8383
*
8484
* @param AbstractDb $collection
85-
* @param bool $limit for limiting maximum amount of query results
8685
* @return AbstractDb
8786
* @throws LocalizedException
8887
*/
89-
public function getCollection(AbstractDb $collection, $limit = true)
88+
public function getCollection(AbstractDb $collection)
9089
{
9190
$selected = $this->request->getParam(static::SELECTED_PARAM);
9291
$excluded = $this->request->getParam(static::EXCLUDED_PARAM);
@@ -100,7 +99,7 @@ public function getCollection(AbstractDb $collection, $limit = true)
10099
}
101100
}
102101
/** @var \Magento\Customer\Model\ResourceModel\Customer\Collection $collection */
103-
$idsArray = $this->getFilterIds($limit);
102+
$idsArray = $this->getFilterIds();
104103
if (!empty($idsArray)) {
105104
$collection->addFieldToFilter(
106105
$collection->getIdFieldName(),
@@ -213,27 +212,24 @@ private function getDataProvider()
213212

214213
/**
215214
* Get filter ids as array
216-
* @param bool $limit
215+
*
217216
* @return int[]
218217
*/
219-
private function getFilterIds($limit = true)
218+
private function getFilterIds()
220219
{
221220
$idsArray = [];
222221
$this->applySelectionOnTargetProvider();
223222
if ($this->getDataProvider() instanceof \Magento\Ui\DataProvider\AbstractDataProvider) {
224223
// Use collection's getAllIds for optimization purposes.
225224
$idsArray = $this->getDataProvider()->getAllIds();
226225
} else {
227-
$searchResult = $this->getDataProvider()->getSearchResult();
228-
if ($limit) {
229-
// Use compatible search api getItems when searchResult is not a collection.
230-
foreach ($searchResult->getItems() as $item) {
231-
/** @var $item \Magento\Framework\Api\Search\DocumentInterface */
232-
$idsArray[] = $item->getId();
233-
}
234-
} else {
235-
//Grab all selected even if they are not on the current page.
236-
$idsArray = $searchResult->getAllIds();
226+
$dataProvider = $this->getDataProvider();
227+
$dataProvider->setLimit(0, false);
228+
$searchResult = $dataProvider->getSearchResult();
229+
// Use compatible search api getItems when searchResult is not a collection.
230+
foreach ($searchResult->getItems() as $item) {
231+
/** @var $item \Magento\Framework\Api\Search\DocumentInterface */
232+
$idsArray[] = $item->getId();
237233
}
238234
}
239235
return $idsArray;

0 commit comments

Comments
 (0)