Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
187aed7d
Commit
187aed7d
authored
Oct 15, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed class references in Events guide
parent
8eedd9a2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
concept-events.md
docs/guide/concept-events.md
+3
-3
No files found.
docs/guide/concept-events.md
View file @
187aed7d
...
@@ -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\Base
ActiveRecord::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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment