I am working on a Yii tutorial and am currently studying filters. Filters can be used generally for the controller or only for specific actions.
In the example that I am working, a new problem is created. Each problem relates to one project, so we add a filter to pass project_idto the page issue/create. Since this issue/createis the only page that needs project_id, we apply a filter to one action:
public function filters(){
return array(
'accessControl',
'projectContext + create',
);
}
My question is this: if the filter is applied to only one action in the controller, why not just put the code filterProjectContext()directly into the function actionCreate()?
source
share