Abstract aggregate listener

package Default
inherited_from \Zend\EventManager\AbstractListenerAggregate

 Methods

{@inheritDoc}

attach(\Zend\EventManager\EventManagerInterface $events) 

Parameters

$events

Detach all previously attached listeners

detach(\Zend\EventManager\EventManagerInterface $events) 
Inherited
inherited_from \Zend\EventManager\ListenerAggregateInterface::detach()

Parameters

$events

Detect if an error is a 404 condition

detectNotFoundError(\Zend\Mvc\MvcEvent $e) : void

If a "controller not found" or "invalid controller" error type is encountered, sets the response status code to 404.

Parameters

$e

\Zend\Mvc\MvcEvent

Should we display exceptions related to a not-found condition?

displayExceptions() : boolean

Returns

boolean

Should we display the reason for a not-found condition?

displayNotFoundReason() : boolean

Returns

boolean

Get template for not found conditions

getNotFoundTemplate() : string

Returns

string

Create and return a 404 view model

prepareNotFoundViewModel(\Zend\Mvc\MvcEvent $e) : void

Parameters

$e

\Zend\Mvc\MvcEvent

Set value indicating whether or not to display exceptions related to a not-found condition

setDisplayExceptions(boolean $displayExceptions) : \Zend\Mvc\View\Http\RouteNotFoundStrategy

Parameters

$displayExceptions

boolean

Returns

\Zend\Mvc\View\Http\RouteNotFoundStrategy

Set value indicating whether or not to display the reason for a not-found condition

setDisplayNotFoundReason(boolean $displayNotFoundReason) : \Zend\Mvc\View\Http\RouteNotFoundStrategy

Parameters

$displayNotFoundReason

boolean

Returns

\Zend\Mvc\View\Http\RouteNotFoundStrategy

Get template for not found conditions

setNotFoundTemplate(string $notFoundTemplate) : \Zend\Mvc\View\Http\RouteNotFoundStrategy

Parameters

$notFoundTemplate

string

Returns

\Zend\Mvc\View\Http\RouteNotFoundStrategy

Inject the controller and controller class into the model

injectController(\Zend\View\Model\ViewModel $model, \Zend\Mvc\MvcEvent $e) : void

If either $displayExceptions or $displayNotFoundReason are enabled, injects the controllerClass from the MvcEvent. It checks to see if a controller is present in the MvcEvent, and, if not, grabs it from the route match if present; if a controller is found, it injects it into the model.

Parameters

$model

\Zend\View\Model\ViewModel

$e

\Zend\Mvc\MvcEvent

Inject the exception message into the model

injectException(\Zend\View\Model\ViewModel $model, \Zend\Mvc\MvcEvent $e) : void

If $displayExceptions is enabled, and an exception is found in the event, inject it into the model.

Parameters

$model

\Zend\View\Model\ViewModel

$e

\Zend\Mvc\MvcEvent

Inject the not-found reason into the model

injectNotFoundReason(\Zend\View\Model\ViewModel $model) : void

If $displayNotFoundReason is enabled, checks to see if $reason is set, and, if so, injects it into the model. If not, it injects Application::ERROR_CONTROLLER_CANNOT_DISPATCH.

Parameters

$model

\Zend\View\Model\ViewModel

 Properties

 

Whether or not to display exceptions related to the 404 condition

$displayExceptions : boolean

Default

false
 

Whether or not to display the reason for a 404

$displayNotFoundReason : boolean

Default

false
 

$listeners

$listeners : array<mixed,\Zend\Stdlib\CallbackHandler>

Default

array()
 

Template to use to report page not found conditions

$notFoundTemplate : string

Default

'error'
 

The reason for a not-found condition

$reason : false | string

Default

false