Skip to content

Commit 6f12219

Browse files
author
Bryant Luk
committed
MAGETWO-36063: Update REST and SOAP controllers to filter out attributes based on ACL
- Fix ExtensionAttributesProcessor
1 parent b83ecf3 commit 6f12219

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

lib/internal/Magento/Framework/Reflection/ExtensionAttributesProcessor.php

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Magento\Framework\Phrase;
1313
use Magento\Framework\Api\SimpleDataObjectConverter;
1414
use Magento\Framework\Api\ExtensionAttributesInterface;
15+
use Magento\Framework\Reflection\MethodsMap;
1516
use Zend\Code\Reflection\MethodReflection;
1617

1718
/**
@@ -24,6 +25,11 @@ class ExtensionAttributesProcessor
2425
*/
2526
private $dataObjectProcessor;
2627

28+
/**
29+
* @var MethodsMap
30+
*/
31+
private $methodsMapProcessor;
32+
2733
/**
2834
* @var AuthorizationInterface
2935
*/
@@ -39,19 +45,38 @@ class ExtensionAttributesProcessor
3945
*/
4046
private $isPermissionChecked;
4147

48+
/**
49+
* @var FieldNamer
50+
*/
51+
private $fieldNamer;
52+
53+
/**
54+
* @var TypeCaster
55+
*/
56+
private $typeCaster;
57+
4258
/**
4359
* @param DataObjectProcessor $dataObjectProcessor
60+
* @param MethodsMap $methodsMapProcessor
61+
* @param TypeCaster $typeCaster
62+
* @param FieldNamer $fieldNamer
4463
* @param AuthorizationInterface $authorization
4564
* @param ExtensionAttributesConfigReader $configReader
4665
* @param bool $isPermissionChecked
4766
*/
4867
public function __construct(
4968
DataObjectProcessor $dataObjectProcessor,
69+
MethodsMap $methodsMapProcessor,
70+
TypeCaster $typeCaster,
71+
FieldNamer $fieldNamer,
5072
AuthorizationInterface $authorization,
5173
ExtensionAttributesConfigReader $configReader,
5274
$isPermissionChecked = false
5375
) {
5476
$this->dataObjectProcessor = $dataObjectProcessor;
77+
$this->methodsMapProcessor = $methodsMapProcessor;
78+
$this->typeCaster = $typeCaster;
79+
$this->fieldNamer = $fieldNamer;
5580
$this->authorization = $authorization;
5681
$this->configReader = $configReader;
5782
$this->isPermissionChecked = $isPermissionChecked;
@@ -66,7 +91,7 @@ public function __construct(
6691
*/
6792
public function buildOutputDataArray(ExtensionAttributesInterface $dataObject, $dataObjectType)
6893
{
69-
$methods = $this->dataObjectProcessor->getMethodsMap($dataObjectType);
94+
$methods = $this->methodsMapProcessor->getMethodsMap($dataObjectType);
7095
$outputData = [];
7196

7297
/** @var MethodReflection $method */
@@ -104,7 +129,7 @@ public function buildOutputDataArray(ExtensionAttributesInterface $dataObject, $
104129
$arrayElementType
105130
);
106131
}
107-
$valueResult[] = $this->dataObjectProcessor->castValueToType($singleValue, $arrayElementType);
132+
$valueResult[] = $this->typeCaster->castValueToType($singleValue, $arrayElementType);
108133
}
109134
$value = $valueResult;
110135
} else {

0 commit comments

Comments
 (0)