mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-14 06:11:35 +08:00
Added beforeRun()
and afterRun()
to yii\base\Action
This commit is contained in:
@ -94,6 +94,7 @@ Yii Framework 2 Change Log
|
||||
- Enh: yii\codeception\TestCase now supports loading and using fixtures via Yii fixture framework (qiangxue)
|
||||
- Enh: Added support to parse json request data to Request::getRestParams() (cebe)
|
||||
- Enh: Added ability to get incoming headers (dizews)
|
||||
- Enh: Added `beforeRun()` and `afterRun()` to `yii\base\Action` (qiangxue)
|
||||
- Chg #1519: `yii\web\User::loginRequired()` now returns the `Response` object instead of exiting the application (qiangxue)
|
||||
- Chg #1586: `QueryBuilder::buildLikeCondition()` will now escape special characters and use percentage characters by default (qiangxue)
|
||||
- Chg #1610: `Html::activeCheckboxList()` and `Html::activeRadioList()` will submit an empty string if no checkbox/radio is selected (qiangxue)
|
||||
|
@ -86,4 +86,23 @@ class Action extends Component
|
||||
}
|
||||
return call_user_func_array([$this, 'run'], $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called right before `run()` is executed.
|
||||
* You may override this method to do preparation work for the action run.
|
||||
* If the method returns false, it will cancel the action.
|
||||
* @return boolean whether to run the action.
|
||||
*/
|
||||
protected function beforeRun()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called right after `run()` is executed.
|
||||
* You may override this method to do post-processing work for the action run.
|
||||
*/
|
||||
protected function afterRun()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user