Zend Framework  3.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
View Class Reference

Public Member Functions

 setRequest (Request $request)
 Set MVC request object.
 
 setResponse (Response $response)
 Set MVC response object.
 
 getRequest ()
 Get MVC request object.
 
 getResponse ()
 Get MVC response object.
 
 setEventManager (EventManagerInterface $events)
 Set the event manager instance.
 
 getEventManager ()
 Retrieve the event manager instance.
 
 addRenderingStrategy ($callable, $priority=1)
 Add a rendering strategy.
 
 addResponseStrategy ($callable, $priority=1)
 Add a response strategy.
 
 render (Model $model)
 Render the provided model.
 

Protected Member Functions

 renderChildren (Model $model)
 Loop through children, rendering each.
 
 getEvent ()
 Create and return ViewEvent used by render()
 

Protected Attributes

 $events
 
 $request
 
 $response
 

Member Function Documentation

addRenderingStrategy (   $callable,
  $priority = 1 
)

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.

Parameters
callable$callable
int$priority
Returns
View
addResponseStrategy (   $callable,
  $priority = 1 
)

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.

Parameters
callable$callable
int$priority
Returns
View
getEvent ( )
protected

Create and return ViewEvent used by render()

Returns
ViewEvent
getEventManager ( )

Retrieve the event manager instance.

Lazy-loads a default instance if none available

Returns
EventManagerInterface

Implements EventsCapableInterface.

getRequest ( )

Get MVC request object.

Returns
null|Request
getResponse ( )

Get MVC response object.

Returns
null|Response
render ( Model  $model)

Render the provided model.

Internally, the following workflow is used:

  • Trigger the "renderer" event to select a renderer.
  • Call the selected renderer with the provided Model
  • Trigger the "response" event

renderer(ViewEvent) response(ViewEvent)

Parameters
Model$model
Exceptions
Exception\RuntimeException
Returns
void
renderChildren ( Model  $model)
protected

Loop through children, rendering each.

Parameters
Model$model
Exceptions
Exception\DomainException
Returns
void
setEventManager ( EventManagerInterface  $events)

Set the event manager instance.

Parameters
EventManagerInterface$events
Returns
View

Implements EventManagerAwareInterface.

setRequest ( Request  $request)

Set MVC request object.

Parameters
Request$request
Returns
View
setResponse ( Response  $response)

Set MVC response object.

Parameters
Response$response
Returns
View

Member Data Documentation

$events
protected
$request
protected
$response
protected