Class View

Summary

Fully Qualified Name: Zend\View\View
Implements: EventManagerAwareInterface

Description

Methods

Name Description Defined By
addRenderingStrategy() Add a rendering strategy View
addResponseStrategy() Add a response strategy View
getEventManager() Retrieve the event manager instance View
getRequest() Get MVC request object View
getResponse() Get MVC response object View
render() Render the provided model. View
setEventManager() Set the event manager instance View
setRequest() Set MVC request object View
setResponse() Set MVC response object View

Method Details

addRenderingStrategy()

Add a rendering strategy

Expects a callable. Strategies should accept a ViewEvent object, and should return a Renderer instance if the strategy is selected.

Internally, the callable provided will be subscribed to the "renderer" event, at the priority specified.

Parameter Name Type Description
$callable callable
$priority int

Returns: \View

addResponseStrategy()

Add a response strategy

Expects a callable. Strategies should accept a ViewEvent object. The return value will be ignored.

Typical usages for a response strategy are to populate the Response object.

Internally, the callable provided will be subscribed to the "response" event, at the priority specified.

Parameter Name Type Description
$callable callable
$priority int

Returns: \View

getEventManager()

Retrieve the event manager instance

Lazy-loads a default instance if none available

Returns: \EventManagerInterface

getRequest()

Get MVC request object

Returns: null|\Request

getResponse()

Get MVC response object

Returns: null|\Response

render()

Render the provided model.

Internally, the following workflow is used:

Parameter Name Type Description
$model \Model

Returns: void

setEventManager()

Set the event manager instance

Parameter Name Type Description
$events \EventManagerInterface

Returns: \View

setRequest()

Set MVC request object

Parameter Name Type Description
$request \Request

Returns: \View

setResponse()

Set MVC response object

Parameter Name Type Description
$response \Response

Returns: \View

Top