Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
|
Public Member Functions | |
__construct (InlineInterface $translateInline, \Magento\Framework\Serialize\Serializer\Json $serializer=null) | |
setData ($data, $cycleCheck=false, $options=[]) | |
setJsonData ($jsonData) | |
![]() | |
setHttpResponseCode ($httpCode) | |
setHeader ($name, $value, $replace=false) | |
setStatusHeader ($httpCode, $version=null, $phrase=null) | |
renderResult (ResponseInterface $response) | |
Protected Member Functions | |
render (HttpResponseInterface $response) | |
![]() | |
applyHttpHeaders (HttpResponseInterface $response) | |
render (HttpResponseInterface $response) | |
Protected Attributes | |
$translateInline | |
$json | |
![]() | |
$httpResponseCode | |
$headers = [] | |
$statusHeaderCode | |
$statusHeaderVersion | |
$statusHeaderPhrase | |
A possible implementation of JSON response type (instead of hardcoding json_encode() all over the place) Actual for controller actions that serve ajax requests
@api
__construct | ( | InlineInterface | $translateInline, |
\Magento\Framework\Serialize\Serializer\Json | $serializer = null |
||
) |
|
protected |
setData | ( | $data, | |
$cycleCheck = false , |
|||
$options = [] |
|||
) |
Set json data
mixed | $data | |
boolean | $cycleCheck | Optional; whether or not to check for object recursion; off by default |
array | $options | Additional options used during encoding |
setJsonData | ( | $jsonData | ) |