Salve a tutti,
sto provando a impostare un filtro nel controller. Ho creato una cartella filters all’interno di protected.
e ho scritto questo:
class PerformanceFilter extends CFilter
{
protected function preFilter($filterChain) {
if(Yii::app()->user->id == "") {
$pippo = true;
$this->actionReturn();
}
return true; // false if the action should not be executed
}
protected function postFilter($filterChain) {
return true; // false if the action should not be executed
}
}
nel controller ho scritto
public function actionReturn() {
$this->redirect(array('autenticazione/autenticazione'));
}
public function filters()
{
return array(
array('application.filters.PerformanceFilter'),
);
}
solamente che ricevo come errore:
PerformanceFilter and its behaviors do not have a method or closure named "actionReturn".
Da quello che ho capito filters “analizza” delle regole prima e dopo la richiesta. io qui voglio semplicemente vedere se l utente è loggato, e se non ho l’id mi fa il redirect
Grazie per l’aiuto