# ActionEvent

> ActionEvent represents the event parameter used for an action event.

[API reference](/docs/api/index.md) › [yii](/docs/api/yii/index.md) › [base](/docs/api/yii/base/index.md) › ActionEvent

| class | `yii\base\ActionEvent` |
| --- | --- |
| Extends | [`Event`](/docs/api/yii/base/event/index.md) » [`BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| Implements | [`Configurable`](/docs/api/yii/base/configurable/index.md) |
| Since | 2.0 |
| Source | [`framework/base/ActionEvent.php`](https://github.com/yiisoft/yii2/blob/22.0/framework/base/ActionEvent.php#L21) |

ActionEvent represents the event parameter used for an action event.

By setting the [`$isValid`](/docs/api/yii/base/actionevent/index.md#property-isValid) property, one may control whether to continue running the action.

## Properties

| Property | Type | Description | Defined by |
| --- | --- | --- | --- |
| <span id="property-action"></span>`$action` | `yii\base\T` | The action currently being executed Default: `null`. | `ActionEvent` |
| <span id="property-data"></span>[`$data`](/docs/api/yii/base/event/index.md#property-data) | `mixed` | The data that is passed to [`Component::on()`](/docs/api/yii/base/component/index.md#method-on) when attaching an event handler. Default: `null`. | [`Event`](/docs/api/yii/base/event/index.md) |
| <span id="property-handled"></span>[`$handled`](/docs/api/yii/base/event/index.md#property-handled) | `bool` | Whether the event is handled. Default: `false`. | [`Event`](/docs/api/yii/base/event/index.md) |
| [`$isValid`](#property-isValid) | `bool` | Whether to continue running the action. Default: `true`. | `ActionEvent` |
| <span id="property-name"></span>[`$name`](/docs/api/yii/base/event/index.md#property-name) | `string` | The event name. Default: `null`. | [`Event`](/docs/api/yii/base/event/index.md) |
| [`$result`](#property-result) | `mixed` | The action result. Default: `null`. | `ActionEvent` |
| <span id="property-sender"></span>[`$sender`](/docs/api/yii/base/event/index.md#property-sender) | `object\|null` | The sender of this event. Default: `null`. | [`Event`](/docs/api/yii/base/event/index.md) |

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Constructor. | `ActionEvent` |
| <span id="method-__call"></span>[`__call()`](/docs/api/yii/base/baseobject/index.md#method-__call) | Calls the named method which is not a class method. | [`BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-__get"></span>[`__get()`](/docs/api/yii/base/baseobject/index.md#method-__get) | Returns the value of an object property. | [`BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-__isset"></span>[`__isset()`](/docs/api/yii/base/baseobject/index.md#method-__isset) | Checks if a property is set, i.e. defined and not null. | [`BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-__set"></span>[`__set()`](/docs/api/yii/base/baseobject/index.md#method-__set) | Sets value of an object property. | [`BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-__unset"></span>[`__unset()`](/docs/api/yii/base/baseobject/index.md#method-__unset) | Sets an object property to null. | [`BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-canGetProperty"></span>[`canGetProperty()`](/docs/api/yii/base/baseobject/index.md#method-canGetProperty) | Returns a value indicating whether a property can be read. | [`BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-canSetProperty"></span>[`canSetProperty()`](/docs/api/yii/base/baseobject/index.md#method-canSetProperty) | Returns a value indicating whether a property can be set. | [`BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-className"></span>[`className()`](/docs/api/yii/base/baseobject/index.md#method-className) static | Returns the fully qualified name of this class. | [`BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-hasHandlers"></span>[`hasHandlers()`](/docs/api/yii/base/event/index.md#method-hasHandlers) static | Returns a value indicating whether there is any handler attached to the specified class-level event. | [`Event`](/docs/api/yii/base/event/index.md) |
| <span id="method-hasMethod"></span>[`hasMethod()`](/docs/api/yii/base/baseobject/index.md#method-hasMethod) | Returns a value indicating whether a method is defined. | [`BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-hasProperty"></span>[`hasProperty()`](/docs/api/yii/base/baseobject/index.md#method-hasProperty) | Returns a value indicating whether a property is defined. | [`BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-init"></span>[`init()`](/docs/api/yii/base/baseobject/index.md#method-init) | Initializes the object. | [`BaseObject`](/docs/api/yii/base/baseobject/index.md) |
| <span id="method-off"></span>[`off()`](/docs/api/yii/base/event/index.md#method-off) static | Detaches an event handler from a class-level event. | [`Event`](/docs/api/yii/base/event/index.md) |
| <span id="method-offAll"></span>[`offAll()`](/docs/api/yii/base/event/index.md#method-offAll) static | Detaches all registered class-level event handlers. | [`Event`](/docs/api/yii/base/event/index.md) |
| <span id="method-on"></span>[`on()`](/docs/api/yii/base/event/index.md#method-on) static | Attaches an event handler to a class-level event. | [`Event`](/docs/api/yii/base/event/index.md) |
| <span id="method-trigger"></span>[`trigger()`](/docs/api/yii/base/event/index.md#method-trigger) static | Triggers a class-level event. | [`Event`](/docs/api/yii/base/event/index.md) |

## Property details

### $isValid <span id="property-isValid"></span>

```php
public bool $isValid = true
```

Whether to continue running the action.

Event handlers of
[`Controller::EVENT_BEFORE_ACTION`](/docs/api/yii/base/controller/index.md#event-EVENT_BEFORE_ACTION) may set this property to decide whether
to continue running the current action.

### $result <span id="property-result"></span>

```php
public mixed $result = null
```

The action result.

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

## Method details

### __construct() <span id="method-__construct"></span>

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

Constructor.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$action` | `yii\base\T` | The action associated with this action event. |
| `$config` | `array<string, mixed>` | Name-value pairs that will be used to initialize the object properties |