@@ -30,7 +30,7 @@ class Export extends \Magento\ImportExport\Model\AbstractModel
30
30
*/
31
31
const FILTER_TYPE_SELECT = 'select ' ;
32
32
33
- const FILTER_TYPE_MULTISELECT ='multiselect ' ;
33
+ const FILTER_TYPE_MULTISELECT = 'multiselect ' ;
34
34
35
35
const FILTER_TYPE_INPUT = 'input ' ;
36
36
@@ -67,6 +67,17 @@ class Export extends \Magento\ImportExport\Model\AbstractModel
67
67
*/
68
68
protected $ _exportAdapterFac ;
69
69
70
+ /**
71
+ * @var array
72
+ */
73
+ public static $ backendTypeToFilterMapper = [
74
+ 'datetime ' => self ::FILTER_TYPE_DATE ,
75
+ 'decimal ' => self ::FILTER_TYPE_NUMBER ,
76
+ 'int ' => self ::FILTER_TYPE_NUMBER ,
77
+ 'varchar ' => self ::FILTER_TYPE_INPUT ,
78
+ 'text ' => self ::FILTER_TYPE_INPUT
79
+ ];
80
+
70
81
/**
71
82
* @param \Psr\Log\LoggerInterface $logger
72
83
* @param \Magento\Framework\Filesystem $filesystem
@@ -82,7 +93,8 @@ public function __construct(
82
93
\Magento \ImportExport \Model \Export \Entity \Factory $ entityFactory ,
83
94
\Magento \ImportExport \Model \Export \Adapter \Factory $ exportAdapterFac ,
84
95
array $ data = []
85
- ) {
96
+ )
97
+ {
86
98
$ this ->_exportConfig = $ exportConfig ;
87
99
$ this ->_entityFactory = $ entityFactory ;
88
100
$ this ->_exportAdapterFac = $ exportAdapterFac ;
@@ -219,19 +231,19 @@ public static function getAttributeFilterType(\Magento\Eav\Model\Entity\Attribut
219
231
if ($ attribute ->usesSource () || $ attribute ->getFilterOptions ()) {
220
232
return 'multiselect ' == $ attribute ->getFrontendInput () ?
221
233
self ::FILTER_TYPE_MULTISELECT : self ::FILTER_TYPE_SELECT ;
222
- } elseif ( ' datetime ' == $ attribute -> getBackendType ()) {
223
- return self :: FILTER_TYPE_DATE ;
224
- } elseif ( ' decimal ' == $ attribute -> getBackendType () || ' int ' == $ attribute ->getBackendType ()) {
225
- return self ::FILTER_TYPE_NUMBER ;
226
- } elseif ( ' varchar ' == $ attribute -> getBackendType () || ' text ' == $ attribute -> getBackendType ()) {
227
- return self :: FILTER_TYPE_INPUT ;
228
- } elseif ($ attribute ->isStatic ()) {
234
+ }
235
+
236
+ if ( isset ( self :: $ backendTypeToFilterMapper [ $ attribute ->getBackendType ()] )) {
237
+ return self ::$ backendTypeToFilterMapper [ $ attribute -> getBackendType ()] ;
238
+ }
239
+
240
+ if ($ attribute ->isStatic ()) {
229
241
return self ::getStaticAttributeFilterType ($ attribute );
230
- } else {
231
- throw new \Magento \Framework \Exception \LocalizedException (
232
- __ ('We can \'t determine the attribute filter type. ' )
233
- );
234
242
}
243
+
244
+ throw new \Magento \Framework \Exception \LocalizedException (
245
+ __ ('We can \'t determine the attribute filter type. ' )
246
+ );
235
247
}
236
248
237
249
/**
0 commit comments