8
8
use Magento \Framework \App \Filesystem \DirectoryList ;
9
9
10
10
/**
11
+ * Extended Grid Widget
12
+ *
11
13
* @api
12
14
* @deprecated 100.2.0 in favour of UI component implementation
13
15
* @SuppressWarnings(PHPMD.ExcessivePublicCount)
@@ -177,7 +179,10 @@ class Extended extends \Magento\Backend\Block\Widget\Grid implements \Magento\Ba
177
179
protected $ _path = 'export ' ;
178
180
179
181
/**
182
+ * Initialization
183
+ *
180
184
* @return void
185
+ * @throws \Magento\Framework\Exception\FileSystemException
181
186
*/
182
187
protected function _construct ()
183
188
{
@@ -297,6 +302,7 @@ public function addColumn($columnId, $column)
297
302
);
298
303
$ this ->getColumnSet ()->getChildBlock ($ columnId )->setGrid ($ this );
299
304
} else {
305
+ // phpcs:ignore Magento2.Exceptions.DirectThrow
300
306
throw new \Exception (__ ('Please correct the column format and try again. ' ));
301
307
}
302
308
@@ -471,10 +477,6 @@ protected function _prepareMassactionColumn()
471
477
protected function _prepareCollection ()
472
478
{
473
479
if ($ this ->getCollection ()) {
474
- if ($ this ->getCollection ()->isLoaded ()) {
475
- $ this ->getCollection ()->clear ();
476
- }
477
-
478
480
parent ::_prepareCollection ();
479
481
480
482
if (!$ this ->_isExport ) {
@@ -663,6 +665,7 @@ public function setEmptyCellLabel($label)
663
665
*/
664
666
public function getRowUrl ($ item )
665
667
{
668
+ // phpstan:ignore "Call to an undefined static method"
666
669
$ res = parent ::getRowUrl ($ item );
667
670
return $ res ? $ res : '# ' ;
668
671
}
@@ -680,6 +683,7 @@ public function getMultipleRows($item)
680
683
681
684
/**
682
685
* Retrieve columns for multiple rows
686
+ *
683
687
* @return array
684
688
*/
685
689
public function getMultipleRowColumns ()
@@ -943,6 +947,7 @@ protected function _getExportTotals()
943
947
944
948
/**
945
949
* Iterate collection and call callback method per item
950
+ *
946
951
* For callback method first argument always is item object
947
952
*
948
953
* @param string $callback
@@ -972,7 +977,12 @@ public function _exportIterateCollection($callback, array $args)
972
977
$ page ++;
973
978
974
979
foreach ($ collection as $ item ) {
975
- call_user_func_array ([$ this , $ callback ], array_merge ([$ item ], $ args ));
980
+ //phpcs:ignore Magento2.Functions.DiscouragedFunction
981
+ call_user_func_array (
982
+ [$ this , $ callback ],
983
+ // phpcs:ignore Magento2.Performance.ForeachArrayMerge
984
+ array_merge ([$ item ], $ args )
985
+ );
976
986
}
977
987
}
978
988
}
@@ -1009,6 +1019,7 @@ public function getCsvFile()
1009
1019
$ this ->_isExport = true ;
1010
1020
$ this ->_prepareGrid ();
1011
1021
1022
+ // phpcs:ignore Magento2.Security.InsecureFunction
1012
1023
$ name = md5 (microtime ());
1013
1024
$ file = $ this ->_path . '/ ' . $ name . '.csv ' ;
1014
1025
@@ -1153,6 +1164,7 @@ public function getExcelFile($sheetName = '')
1153
1164
[$ this , 'getRowRecord ' ]
1154
1165
);
1155
1166
1167
+ // phpcs:ignore Magento2.Security.InsecureFunction
1156
1168
$ name = md5 (microtime ());
1157
1169
$ file = $ this ->_path . '/ ' . $ name . '.xml ' ;
1158
1170
@@ -1244,7 +1256,7 @@ public function setCollection($collection)
1244
1256
}
1245
1257
1246
1258
/**
1247
- * get collection object
1259
+ * Get collection object
1248
1260
*
1249
1261
* @return \Magento\Framework\Data\Collection
1250
1262
*/
0 commit comments