Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
|
Public Member Functions | |
__construct (array $paramOverriders=[]) | |
override (array $inputData, array $parameters) | |
overrideRequestBodyIdWithPathParam (array $urlPathParams, array $requestBodyParams, $serviceClassName, $serviceMethodName) | |
Protected Member Functions | |
isNestedArrayValueSet (&$nestedArray, $arrayKeys) | |
setNestedArrayValue (&$nestedArray, $arrayKeys, $valueToSet) | |
Override parameter values
Definition at line 17 of file ParamsOverrider.php.
__construct | ( | array | $paramOverriders = [] | ) |
Initialize dependencies
ParamOverriderInterface[] | $paramOverriders |
Definition at line 34 of file ParamsOverrider.php.
|
protected |
Determine if a nested array value is set.
array | &$nestedArray | |
string[] | $arrayKeys |
Definition at line 71 of file ParamsOverrider.php.
override | ( | array | $inputData, |
array | $parameters | ||
) |
Override parameter values based on webapi.xml
array | $inputData | Incoming data from request |
array | $parameters | Contains parameters to replace or default |
Definition at line 47 of file ParamsOverrider.php.
overrideRequestBodyIdWithPathParam | ( | array | $urlPathParams, |
array | $requestBodyParams, | ||
$serviceClassName, | |||
$serviceMethodName | |||
) |
Override request body property value with matching url path parameter value
This method assumes that webapi.xml url defines the substitution parameter as camelCase to the actual snake case key described as part of the api contract. example: /:parentId/nestedResource/:entityId. Here :entityId value will be used for overriding 'entity_id' property in the body. Since Webapi framework allows both camelCase and snakeCase, either of them will be substituted for now. If the request body is missing url path parameter as property, it will be added to the body. This method works only requests with scalar properties at top level or properties of single object embedded in the request body. Only the last path parameter value will be substituted from the url in case of multiple parameters.
array | $urlPathParams | url path parameters as array |
array | $requestBodyParams | body parameters as array |
string | $serviceClassName | name of the service class that we are trying to call |
string | $serviceMethodName | name of the method that we are trying to call |
Definition at line 125 of file ParamsOverrider.php.
|
protected |
Set a nested array value.
array | &$nestedArray | |
string[] | $arrayKeys | |
string | $valueToSet |
Definition at line 92 of file ParamsOverrider.php.