@@ -82,11 +82,10 @@ public function getComponent()
82
82
* Adds filters to collection using DataProvider filter results
83
83
*
84
84
* @param AbstractDb $collection
85
- * @param bool $limit for limiting maximum amount of query results
86
85
* @return AbstractDb
87
86
* @throws LocalizedException
88
87
*/
89
- public function getCollection (AbstractDb $ collection, $ limit = true )
88
+ public function getCollection (AbstractDb $ collection )
90
89
{
91
90
$ selected = $ this ->request ->getParam (static ::SELECTED_PARAM );
92
91
$ excluded = $ this ->request ->getParam (static ::EXCLUDED_PARAM );
@@ -100,7 +99,7 @@ public function getCollection(AbstractDb $collection, $limit = true)
100
99
}
101
100
}
102
101
/** @var \Magento\Customer\Model\ResourceModel\Customer\Collection $collection */
103
- $ idsArray = $ this ->getFilterIds ($ limit );
102
+ $ idsArray = $ this ->getFilterIds ();
104
103
if (!empty ($ idsArray )) {
105
104
$ collection ->addFieldToFilter (
106
105
$ collection ->getIdFieldName (),
@@ -213,27 +212,24 @@ private function getDataProvider()
213
212
214
213
/**
215
214
* Get filter ids as array
216
- * @param bool $limit
215
+ *
217
216
* @return int[]
218
217
*/
219
- private function getFilterIds ($ limit = true )
218
+ private function getFilterIds ()
220
219
{
221
220
$ idsArray = [];
222
221
$ this ->applySelectionOnTargetProvider ();
223
222
if ($ this ->getDataProvider () instanceof \Magento \Ui \DataProvider \AbstractDataProvider) {
224
223
// Use collection's getAllIds for optimization purposes.
225
224
$ idsArray = $ this ->getDataProvider ()->getAllIds ();
226
225
} 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 ();
237
233
}
238
234
}
239
235
return $ idsArray ;
0 commit comments