Abstract aggregate listener

 Methods

Attach one or more listeners

attach(\Zend\EventManager\EventManagerInterface $events) : void

Implementors may add an optional $priority argument; the EventManager implementation will pass this to the aggregate.

Parameters

Detach all previously attached listeners

detach(\Zend\EventManager\EventManagerInterface $events) : void
Inherited

inherited_from \Zend\EventManager\AbstractListenerAggregate::detach()

Parameters

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

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

displayExceptions() : bool

Returns

bool

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

displayNotFoundReason() : bool

Returns

bool

Get template for not found conditions

getNotFoundTemplate() : string

Returns

string

Create and return a 404 view model

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

Parameters

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

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

Parameters

$displayExceptions

bool

Returns

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

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

Parameters

$displayNotFoundReason

bool

Returns

Get template for not found conditions

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

Parameters

$notFoundTemplate

string

Returns

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

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

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

 Properties

 

Whether or not to display exceptions related to the 404 condition

$displayExceptions : bool

 

Whether or not to display the reason for a 404

$displayNotFoundReason : bool

 

$listeners

$listeners : \Zend\Stdlib\CallbackHandler[]
Inherited

inherited_from \Zend\EventManager\AbstractListenerAggregate::$$listeners
 

Template to use to report page not found conditions

$notFoundTemplate : string

 

The reason for a not-found condition

$reason : false | string