Representation of an event

Encapsulates the target context and parameters passed, and provides some behavior for interacting with the event manager.

package Default
inherited_from \Zend\EventManager\Event

 Methods

Constructor

__construct(string $name = null, string|object $target = null, array|\ArrayAccess $params = null
Inherited

Accept a target and its parameters.

Parameters

$name

string

Event name

$target

stringobject

$params

array\ArrayAccess

Get application instance

getApplication() : \Zend\Mvc\ApplicationInterface

Returns

\Zend\Mvc\ApplicationInterface

Get the currently registered controller name

getController() : string

Returns

string

Get controller class

getControllerClass() : string

Returns

string

Retrieve the error message, if any

getError() : string

Returns

string

Get event name

getName() : string
Inherited
inherited_from \Zend\EventManager\EventInterface::getName()

Returns

string

Get an individual parameter

getParam(string|integer $name, mixed $default = null) : mixed
Inherited

If the parameter does not exist, the $default value will be returned.

inherited_from \Zend\EventManager\EventInterface::getParam()

Parameters

$name

stringinteger

$default

mixed

Returns

mixed

Get all parameters

getParams() : array | object | \ArrayAccess
Inherited
inherited_from \Zend\EventManager\EventInterface::getParams()

Returns

arrayobject\ArrayAccess

Get request

getRequest() : \Zend\Stdlib\RequestInterface

Returns

\Zend\Stdlib\RequestInterface

Get response

getResponse() : \Zend\Stdlib\ResponseInterface

Returns

\Zend\Stdlib\ResponseInterface

Get result

getResult() : mixed

Returns

mixed

Get route match

getRouteMatch() : \Zend\Mvc\Router\RouteMatch

Returns

\Zend\Mvc\Router\RouteMatch

Get router

getRouter() : \Zend\Mvc\Router\RouteStackInterface

Returns

\Zend\Mvc\Router\RouteStackInterface

Get the event target

getTarget() : string | object
Inherited

This may be either an object, or the name of a static method.

inherited_from \Zend\EventManager\EventInterface::getTarget()

Returns

stringobject

Get the view model

getViewModel() : \Zend\View\Model\ModelInterface

Returns

\Zend\View\Model\ModelInterface

Does the event represent an error response?

isError() : boolean

Returns

boolean

Is propagation stopped?

propagationIsStopped() : boolean
Inherited
inherited_from \Zend\EventManager\EventInterface::propagationIsStopped()

Returns

boolean

Set application instance

setApplication(\Zend\Mvc\ApplicationInterface $application) : \Zend\Mvc\MvcEvent

Parameters

$application

\Zend\Mvc\ApplicationInterface

Returns

\Zend\Mvc\MvcEvent

Set controller name

setController(string $name) : \Zend\Mvc\MvcEvent

Parameters

$name

string

Returns

\Zend\Mvc\MvcEvent

Set controller class

setControllerClass(string $class) : \Zend\Mvc\MvcEvent

Parameters

$class

string

Returns

\Zend\Mvc\MvcEvent

Set the error message (indicating error in handling request)

setError(string $message) : \Zend\Mvc\MvcEvent

Parameters

$message

string

Returns

\Zend\Mvc\MvcEvent

Set the event name

setName(string $name) : \Zend\EventManager\Event
Inherited
inherited_from \Zend\EventManager\EventInterface::setName()

Parameters

$name

string

Returns

\Zend\EventManager\Event

Set an individual parameter to a value

setParam(string|integer $name, mixed $value) : \Zend\EventManager\Event
Inherited
inherited_from \Zend\EventManager\EventInterface::setParam()

Parameters

$name

stringinteger

$value

mixed

Returns

\Zend\EventManager\Event

Set parameters

setParams(array|\ArrayAccess|object $params) : \Zend\EventManager\Event
Inherited

Overwrites parameters

inherited_from \Zend\EventManager\EventInterface::setParams()

Parameters

$params

array\ArrayAccessobject

Exceptions

\Zend\EventManager\Exception\InvalidArgumentException

Returns

\Zend\EventManager\Event

Set request

setRequest(\Zend\Stdlib\RequestInterface $request) : \Zend\Mvc\MvcEvent

Parameters

$request

\Zend\Stdlib\RequestInterface

Returns

\Zend\Mvc\MvcEvent

Set response

setResponse(\Zend\Stdlib\ResponseInterface $response) : \Zend\Mvc\MvcEvent

Parameters

$response

\Zend\Stdlib\ResponseInterface

Returns

\Zend\Mvc\MvcEvent

Set result

setResult(mixed $result) : \Zend\Mvc\MvcEvent

Parameters

$result

mixed

Returns

\Zend\Mvc\MvcEvent

Set route match

setRouteMatch(\Zend\Mvc\Router\RouteMatch $matches) : \Zend\Mvc\MvcEvent

Parameters

$matches

\Zend\Mvc\Router\RouteMatch

Returns

\Zend\Mvc\MvcEvent

Set router

setRouter(\Zend\Mvc\Router\RouteStackInterface $router) : \Zend\Mvc\MvcEvent

Parameters

$router

\Zend\Mvc\Router\RouteStackInterface

Returns

\Zend\Mvc\MvcEvent

Set the event target/context

setTarget(null|string|object $target) : \Zend\EventManager\Event
Inherited
inherited_from \Zend\EventManager\EventInterface::setTarget()

Parameters

$target

nullstringobject

Returns

\Zend\EventManager\Event

Set the view model

setViewModel(\Zend\View\Model\ModelInterface $viewModel) : \Zend\Mvc\MvcEvent

Parameters

$viewModel

\Zend\View\Model\ModelInterface

Returns

\Zend\Mvc\MvcEvent

Stop further event propagation

stopPropagation(boolean $flag = true) : void
Inherited
inherited_from \Zend\EventManager\EventInterface::stopPropagation()

Parameters

$flag

boolean

 Properties

 

$application

$application 

Default

 

Event name

$name : string

Default

 

The event parameters

$params : array | \ArrayAccess | object

Default

array()
 

$request

$request : \Zend\Stdlib\RequestInterface

Default

 

$response

$response : \Zend\Stdlib\ResponseInterface

Default

 

$result

$result : mixed

Default

 

$routeMatch

$routeMatch : \Zend\Mvc\Router\RouteMatch

Default

 

$router

$router : \Zend\Mvc\Router\RouteStackInterface

Default

 

Whether or not to stop propagation

$stopPropagation : boolean

Default

false
 

The event target

$target : string | object

Default

 

$viewModel

$viewModel : \Zend\View\Model\ModelInterface

Default

 Constants

 

EVENT_BOOTSTRAP

EVENT_BOOTSTRAP = 'bootstrap' 
 

EVENT_DISPATCH

EVENT_DISPATCH = 'dispatch' 
 

EVENT_DISPATCH_ERROR

EVENT_DISPATCH_ERROR = 'dispatch.error' 
 

EVENT_FINISH

EVENT_FINISH = 'finish' 
 

EVENT_RENDER

EVENT_RENDER = 'render' 
 

EVENT_RENDER_ERROR

EVENT_RENDER_ERROR = 'render.error' 
 

EVENT_ROUTE

EVENT_ROUTE = 'route'