12
12
use Magento \Framework \Phrase ;
13
13
use Magento \Framework \Api \SimpleDataObjectConverter ;
14
14
use Magento \Framework \Api \ExtensionAttributesInterface ;
15
+ use Magento \Framework \Reflection \MethodsMap ;
15
16
use Zend \Code \Reflection \MethodReflection ;
16
17
17
18
/**
@@ -24,6 +25,11 @@ class ExtensionAttributesProcessor
24
25
*/
25
26
private $ dataObjectProcessor ;
26
27
28
+ /**
29
+ * @var MethodsMap
30
+ */
31
+ private $ methodsMapProcessor ;
32
+
27
33
/**
28
34
* @var AuthorizationInterface
29
35
*/
@@ -39,19 +45,38 @@ class ExtensionAttributesProcessor
39
45
*/
40
46
private $ isPermissionChecked ;
41
47
48
+ /**
49
+ * @var FieldNamer
50
+ */
51
+ private $ fieldNamer ;
52
+
53
+ /**
54
+ * @var TypeCaster
55
+ */
56
+ private $ typeCaster ;
57
+
42
58
/**
43
59
* @param DataObjectProcessor $dataObjectProcessor
60
+ * @param MethodsMap $methodsMapProcessor
61
+ * @param TypeCaster $typeCaster
62
+ * @param FieldNamer $fieldNamer
44
63
* @param AuthorizationInterface $authorization
45
64
* @param ExtensionAttributesConfigReader $configReader
46
65
* @param bool $isPermissionChecked
47
66
*/
48
67
public function __construct (
49
68
DataObjectProcessor $ dataObjectProcessor ,
69
+ MethodsMap $ methodsMapProcessor ,
70
+ TypeCaster $ typeCaster ,
71
+ FieldNamer $ fieldNamer ,
50
72
AuthorizationInterface $ authorization ,
51
73
ExtensionAttributesConfigReader $ configReader ,
52
74
$ isPermissionChecked = false
53
75
) {
54
76
$ this ->dataObjectProcessor = $ dataObjectProcessor ;
77
+ $ this ->methodsMapProcessor = $ methodsMapProcessor ;
78
+ $ this ->typeCaster = $ typeCaster ;
79
+ $ this ->fieldNamer = $ fieldNamer ;
55
80
$ this ->authorization = $ authorization ;
56
81
$ this ->configReader = $ configReader ;
57
82
$ this ->isPermissionChecked = $ isPermissionChecked ;
@@ -66,7 +91,7 @@ public function __construct(
66
91
*/
67
92
public function buildOutputDataArray (ExtensionAttributesInterface $ dataObject , $ dataObjectType )
68
93
{
69
- $ methods = $ this ->dataObjectProcessor ->getMethodsMap ($ dataObjectType );
94
+ $ methods = $ this ->methodsMapProcessor ->getMethodsMap ($ dataObjectType );
70
95
$ outputData = [];
71
96
72
97
/** @var MethodReflection $method */
@@ -104,7 +129,7 @@ public function buildOutputDataArray(ExtensionAttributesInterface $dataObject, $
104
129
$ arrayElementType
105
130
);
106
131
}
107
- $ valueResult [] = $ this ->dataObjectProcessor ->castValueToType ($ singleValue , $ arrayElementType );
132
+ $ valueResult [] = $ this ->typeCaster ->castValueToType ($ singleValue , $ arrayElementType );
108
133
}
109
134
$ value = $ valueResult ;
110
135
} else {
0 commit comments