Skip to content
PHP Ecosystem
Explore

ActionEvent

API reference › yii › base › ActionEvent

classyii\base\ActionEvent
ExtendsEvent » BaseObject
ImplementsConfigurable
Since2.0
Sourceframework/base/ActionEvent.php

ActionEvent represents the event parameter used for an action event.

By setting the $isValid property, one may control whether to continue running the action.

PropertyTypeDescriptionDefined by
$actionyii\base\TThe action currently being executed Default: null.ActionEvent
$datamixedThe data that is passed to Component::on() when attaching an event handler. Default: null.Event
$handledboolWhether the event is handled. Default: false.Event
$isValidboolWhether to continue running the action. Default: true.ActionEvent
$namestringThe event name. Default: null.Event
$resultmixedThe action result. Default: null.ActionEvent
$senderobject|nullThe sender of this event. Default: null.Event
MethodDescriptionDefined by
__construct()Constructor.ActionEvent
__call()Calls the named method which is not a class method.BaseObject
__get()Returns the value of an object property.BaseObject
__isset()Checks if a property is set, i.e. defined and not null.BaseObject
__set()Sets value of an object property.BaseObject
__unset()Sets an object property to null.BaseObject
canGetProperty()Returns a value indicating whether a property can be read.BaseObject
canSetProperty()Returns a value indicating whether a property can be set.BaseObject
className() staticReturns the fully qualified name of this class.BaseObject
hasHandlers() staticReturns a value indicating whether there is any handler attached to the specified class-level event.Event
hasMethod()Returns a value indicating whether a method is defined.BaseObject
hasProperty()Returns a value indicating whether a property is defined.BaseObject
init()Initializes the object.BaseObject
off() staticDetaches an event handler from a class-level event.Event
offAll() staticDetaches all registered class-level event handlers.Event
on() staticAttaches an event handler to a class-level event.Event
trigger() staticTriggers a class-level event.Event
public bool $isValid = true

Whether to continue running the action.

Event handlers of Controller::EVENT_BEFORE_ACTION may set this property to decide whether to continue running the current action.

public mixed $result = null

The action result.

Event handlers may modify this property to change the action result.

public function __construct(yii\base\T $action, array<string, mixed> $config = [])

Constructor.

Parameters

ParameterTypeDescription
$actionyii\base\TThe action associated with this action event.
$configarray<string, mixed>Name-value pairs that will be used to initialize the object properties