mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 14:26:54 +08:00
Update concept-events.md
Minor syntax changes.
This commit is contained in:
@ -131,8 +131,8 @@ With the above code, any calls to `bar()` will trigger an event named `hello`.
|
|||||||
Sometimes when triggering an event you may want to pass along additional information to the event handlers.
|
Sometimes when triggering an event you may want to pass along additional information to the event handlers.
|
||||||
For example, a mailer may want pass the message information to the handlers of the `messageSent` event so that the handlers
|
For example, a mailer may want pass the message information to the handlers of the `messageSent` event so that the handlers
|
||||||
can know the particulars of the sent messages. To do so, you can provide an event object as the second parameter to
|
can know the particulars of the sent messages. To do so, you can provide an event object as the second parameter to
|
||||||
the [[yii\base\Component::trigger()]] method. The event object must be an instance of the [[yii\base\Event]] class,
|
the [[yii\base\Component::trigger()]] method. The event object must be an instance of the [[yii\base\Event]] class
|
||||||
or of a child class. For example:
|
or a child class. For example:
|
||||||
|
|
||||||
```php
|
```php
|
||||||
namespace app\components;
|
namespace app\components;
|
||||||
|
Reference in New Issue
Block a user