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
7a587f62
Commit
7a587f62
authored
Jun 30, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added back the events for Controller.
parent
55daae47
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
Controller.php
framework/yii/base/Controller.php
+15
-1
No files found.
framework/yii/base/Controller.php
View file @
7a587f62
...
@@ -18,6 +18,15 @@ use Yii;
...
@@ -18,6 +18,15 @@ use Yii;
class
Controller
extends
Component
class
Controller
extends
Component
{
{
/**
/**
* @event ActionEvent an event raised right before executing a controller action.
* You may set [[ActionEvent::isValid]] to be false to cancel the action execution.
*/
const
EVENT_BEFORE_ACTION
=
'beforeAction'
;
/**
* @event ActionEvent an event raised right after executing a controller action.
*/
const
EVENT_AFTER_ACTION
=
'afterAction'
;
/**
* @var string the ID of this controller
* @var string the ID of this controller
*/
*/
public
$id
;
public
$id
;
...
@@ -192,7 +201,9 @@ class Controller extends Component
...
@@ -192,7 +201,9 @@ class Controller extends Component
*/
*/
public
function
beforeAction
(
$action
)
public
function
beforeAction
(
$action
)
{
{
return
true
;
$event
=
new
ActionEvent
(
$action
);
$this
->
trigger
(
self
::
EVENT_BEFORE_ACTION
,
$event
);
return
$event
->
isValid
;
}
}
/**
/**
...
@@ -203,6 +214,9 @@ class Controller extends Component
...
@@ -203,6 +214,9 @@ class Controller extends Component
*/
*/
public
function
afterAction
(
$action
,
&
$result
)
public
function
afterAction
(
$action
,
&
$result
)
{
{
$event
=
new
ActionEvent
(
$action
);
$event
->
result
=
&
$result
;
$this
->
trigger
(
self
::
EVENT_AFTER_ACTION
,
$event
);
}
}
/**
/**
...
...
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