Difference between #2 and #3 of
Events registration examples

Revision #3 has been created by minitia on Mar 11, 2019, 2:03:38 PM with the memo:

correction
« previous (#2) next (#4) »

Changes

Title unchanged

Events registration examples

Category unchanged

How-tos

Yii version unchanged

2.0

Tags changed

events,yii2

Content changed

[...]
taked from
https://stackoverflow.com/questions/28575636/how-to-use-events-in-yii2

**Register an event handler at Class-Level**

To register event handle
rs at Class-Level a good place can be inside the bootstrap process.

So, you can put the registration code as

```php
Event::on(ActiveRecord::className(), ActiveRecord::EVENT_AFTER_INSERT, function ($event) {
[...]
2 0
2 followers
Viewed: 61 723 times
Version: 2.0
Category: How-tos
Tags: events, yii2
Written by: minitia
Last updated by: minitia
Created on: Mar 11, 2019
Last updated: 5 years ago
Update Article

Revisions

View all history