Commit 187aed7d by Alexander Makarov

Fixed class references in Events guide

parent 8eedd9a2
...@@ -202,7 +202,7 @@ Sometimes, you may want to respond to an event triggered by *every* instance of ...@@ -202,7 +202,7 @@ Sometimes, you may want to respond to an event triggered by *every* instance of
a specific instance. Instead of attaching an event handler to every instance, you may attach the handler a specific instance. Instead of attaching an event handler to every instance, you may attach the handler
on the *class level* by calling the static method [[yii\base\Event::on()]]. on the *class level* by calling the static method [[yii\base\Event::on()]].
For example, an [Active Record](db-active-record.md) object will trigger an [[yii\base\ActiveRecord::EVENT_AFTER_INSERT]] For example, an [Active Record](db-active-record.md) object will trigger an [[yii\db\BaseActiveRecord::EVENT_AFTER_INSERT|EVENT_AFTER_INSERT]]
event whenever it inserts a new record into the database. In order to track insertions done by *every* event whenever it inserts a new record into the database. In order to track insertions done by *every*
[Active Record](db-active-record.md) object, you may use the following code: [Active Record](db-active-record.md) object, you may use the following code:
...@@ -216,8 +216,8 @@ Event::on(ActiveRecord::className(), ActiveRecord::EVENT_AFTER_INSERT, function ...@@ -216,8 +216,8 @@ Event::on(ActiveRecord::className(), ActiveRecord::EVENT_AFTER_INSERT, function
}); });
``` ```
The event handler will be invoked whenever an instance of [[yii\base\ActiveRecord|ActiveRecord]], or one of its child classes, triggers The event handler will be invoked whenever an instance of [[yii\db\ActiveRecord|ActiveRecord]], or one of its child classes, triggers
the [[yii\base\ActiveRecord::EVENT_AFTER_INSERT|EVENT_AFTER_INSERT]] event. In the handler, you can get the object the [[yii\db\BaseActiveRecord::EVENT_AFTER_INSERT|EVENT_AFTER_INSERT]] event. In the handler, you can get the object
that triggered the event through `$event->sender`. that triggered the event through `$event->sender`.
When an object triggers an event, it will first call instance-level handlers, followed by the class-level handlers. When an object triggers an event, it will first call instance-level handlers, followed by the class-level handlers.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment