UserEvent
API reference › yii › web › UserEvent
This event class is used for Events triggered by the User class.
Properties
Section titled “Properties”| Property | Type | Description | Defined by |
|---|---|---|---|
$cookieBased | bool | Whether the login is cookie-based. Default: null. | UserEvent |
$data | mixed | The data that is passed to Component::on() when attaching an event handler. Default: null. | yii\ |
$duration | int | Number of seconds that the user can remain in logged-in status. Default: null. | UserEvent |
$handled | bool | Whether the event is handled. Default: false. | yii\ |
$identity | IdentityInterface | The identity object associated with this event Default: null. | UserEvent |
$isValid | bool | Whether the login or logout should proceed. Default: true. | UserEvent |
$name | string | The event name. Default: null. | yii\ |
$sender | object| | The sender of this event. Default: null. | yii\ |
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
__construct() | Constructor. | yii\ |
__call() | Calls the named method which is not a class method. | yii\ |
__get() | Returns the value of an object property. | yii\ |
__isset() | Checks if a property is set, i.e. defined and not null. | yii\ |
__set() | Sets value of an object property. | yii\ |
__unset() | Sets an object property to null. | yii\ |
canGetProperty() | Returns a value indicating whether a property can be read. | yii\ |
canSetProperty() | Returns a value indicating whether a property can be set. | yii\ |
className() static | Returns the fully qualified name of this class. | yii\ |
hasHandlers() static | Returns a value indicating whether there is any handler attached to the specified class-level event. | yii\ |
hasMethod() | Returns a value indicating whether a method is defined. | yii\ |
hasProperty() | Returns a value indicating whether a property is defined. | yii\ |
init() | Initializes the object. | yii\ |
off() static | Detaches an event handler from a class-level event. | yii\ |
offAll() static | Detaches all registered class-level event handlers. | yii\ |
on() static | Attaches an event handler to a class-level event. | yii\ |
trigger() static | Triggers a class-level event. | yii\ |
Property details
Section titled “Property details”$cookieBased
Section titled “$cookieBased ”public bool $cookieBased = nullWhether the login is cookie-based.
This property is only meaningful
for User::EVENT_BEFORE_LOGIN and User::EVENT_AFTER_LOGIN events.
$duration
Section titled “$duration ”public int $duration = nullNumber of seconds that the user can remain in logged-in status.
If 0, it means login till the user closes the browser or the session is manually destroyed.
$isValid
Section titled “$isValid ”public bool $isValid = trueWhether the login or logout should proceed.
Event handlers may modify this property to determine whether the login or logout should proceed.
This property is only meaningful for User::EVENT_BEFORE_LOGIN and User::EVENT_BEFORE_LOGOUT events.