22 private $methodsMapProcessor;
37 private $extensionAttributesProcessor;
42 private $customAttributesProcessor;
58 $this->methodsMapProcessor = $methodsMapProcessor;
59 $this->typeCaster = $typeCaster;
60 $this->fieldNamer = $fieldNamer;
61 $this->extensionAttributesProcessor = $extensionAttributesProcessor;
62 $this->customAttributesProcessor = $customAttributesProcessor;
75 $methods = $this->methodsMapProcessor->getMethodsMap($dataObjectType);
78 foreach (array_keys(
$methods) as $methodName) {
79 if (!$this->methodsMapProcessor->isMethodValidForDataField($dataObjectType, $methodName)) {
83 $value = $dataObject->{$methodName}();
84 $isMethodReturnValueRequired = $this->methodsMapProcessor->isMethodReturnValueRequired(
88 if (
$value ===
null && !$isMethodReturnValueRequired) {
92 $returnType = $this->methodsMapProcessor->getMethodReturnType($dataObjectType, $methodName);
93 $key = $this->fieldNamer->getFieldNameForMethodName($methodName);
99 $value = $this->customAttributesProcessor->buildOutputDataArray($dataObject, $dataObjectType);
100 }
elseif ($key ===
"extension_attributes") {
101 $value = $this->extensionAttributesProcessor->buildOutputDataArray(
$value, $returnType);
110 $arrayElementType = substr($returnType, 0, -2);
111 foreach (
$value as $singleValue) {
112 if (is_object($singleValue) && !($singleValue instanceof
Phrase)) {
115 $valueResult[] = $this->typeCaster->castValueToType($singleValue, $arrayElementType);
119 $value = $this->typeCaster->castValueToType(
$value, $returnType);
123 $outputData[$key] =
$value;
elseif(isset( $params[ 'redirect_parent']))
__construct(MethodsMap $methodsMapProcessor, TypeCaster $typeCaster, FieldNamer $fieldNamer, CustomAttributesProcessor $customAttributesProcessor, ExtensionAttributesProcessor $extensionAttributesProcessor)
buildOutputDataArray($dataObject, $dataObjectType)