File tree Expand file tree Collapse file tree 3 files changed +29
-20
lines changed
app/code/Magento/Catalog/Model/ResourceModel/Eav
lib/internal/Magento/Framework Expand file tree Collapse file tree 3 files changed +29
-20
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,18 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute implements
38
38
39
39
const KEY_IS_GLOBAL = 'is_global ' ;
40
40
41
+ private const ALLOWED_INPUT_TYPES = [
42
+ 'boolean ' => true ,
43
+ 'date ' => true ,
44
+ 'datetime ' => true ,
45
+ 'multiselect ' => true ,
46
+ 'price ' => true ,
47
+ 'select ' => true ,
48
+ 'text ' => true ,
49
+ 'textarea ' => true ,
50
+ 'weight ' => true ,
51
+ ];
52
+
41
53
/**
42
54
* @var LockValidatorInterface
43
55
*/
@@ -403,18 +415,7 @@ public function getSourceModel()
403
415
*/
404
416
public function isAllowedForRuleCondition ()
405
417
{
406
- $ allowedInputTypes = [
407
- 'boolean ' ,
408
- 'date ' ,
409
- 'datetime ' ,
410
- 'multiselect ' ,
411
- 'price ' ,
412
- 'select ' ,
413
- 'text ' ,
414
- 'textarea ' ,
415
- 'weight ' ,
416
- ];
417
- return $ this ->getIsVisible () && in_array ($ this ->getFrontendInput (), $ allowedInputTypes );
418
+ return $ this ->getIsVisible () && isset (self ::ALLOWED_INPUT_TYPES [$ this ->getFrontendInput ()]);
418
419
}
419
420
420
421
/**
Original file line number Diff line number Diff line change 12
12
*/
13
13
class SelectRenderer implements RendererInterface
14
14
{
15
+ private const MANDATORY_SELECT_PARTS = [
16
+ Select::COLUMNS => true ,
17
+ Select::FROM => true
18
+ ];
19
+
15
20
/**
16
21
* @var RendererInterface[]
17
22
*/
@@ -67,7 +72,8 @@ public function render(Select $select, $sql = '')
67
72
{
68
73
$ sql = Select::SQL_SELECT ;
69
74
foreach ($ this ->renderers as $ renderer ) {
70
- if (in_array ($ renderer ['part ' ], [Select::COLUMNS , Select::FROM ]) || $ select ->getPart ($ renderer ['part ' ])) {
75
+ $ part = $ renderer ['part ' ];
76
+ if (isset (self ::MANDATORY_SELECT_PARTS [$ part ]) || $ select ->getPart ($ part )) {
71
77
$ sql = $ renderer ['renderer ' ]->render ($ select , $ sql );
72
78
}
73
79
}
Original file line number Diff line number Diff line change @@ -22,6 +22,14 @@ class Dir
22
22
const MODULE_SETUP_DIR = 'Setup ' ;
23
23
/**#@-*/
24
24
25
+ private const ALLOWED_DIR_TYPES = [
26
+ self ::MODULE_ETC_DIR => true ,
27
+ self ::MODULE_I18N_DIR => true ,
28
+ self ::MODULE_VIEW_DIR => true ,
29
+ self ::MODULE_CONTROLLER_DIR => true ,
30
+ self ::MODULE_SETUP_DIR => true
31
+ ];
32
+
25
33
/**#@-*/
26
34
private $ componentRegistrar ;
27
35
@@ -52,13 +60,7 @@ public function getDir($moduleName, $type = '')
52
60
}
53
61
54
62
if ($ type ) {
55
- if (!in_array ($ type , [
56
- self ::MODULE_ETC_DIR ,
57
- self ::MODULE_I18N_DIR ,
58
- self ::MODULE_VIEW_DIR ,
59
- self ::MODULE_CONTROLLER_DIR ,
60
- self ::MODULE_SETUP_DIR
61
- ])) {
63
+ if (!isset (self ::ALLOWED_DIR_TYPES [$ type ])) {
62
64
throw new \InvalidArgumentException ("Directory type ' {$ type }' is not recognized. " );
63
65
}
64
66
$ path .= '/ ' . $ type ;
You can’t perform that action at this time.
0 commit comments