Extension of the JSON strategy to handle the RestfulJsonModel and provide a Content-Type header appropriate to the response it describes.

This will give the following content types:

  • application/hal+json for a result that contains HAL-compliant links
  • application/api-problem+json for a result that contains a Problem API-formatted response
  • application/json for all other responses

 Methods

__construct()

__construct(\PhlyRestfully\View\RestfulJsonRenderer $renderer) 

Parameters

$renderer

Inject the response

injectResponse(\Zend\View\ViewEvent $e) 

Injects the response with the rendered content, and sets the content type based on the detection that occurred during renderer selection.

Parameters

$e

\Zend\View\ViewEvent

Detect if we should use the RestfulJsonRenderer based on model type.

selectRenderer(\Zend\View\ViewEvent $e) : null | \PhlyRestfully\View\RestfulJsonRenderer

Parameters

$e

\Zend\View\ViewEvent

Returns