I’m using an ActionFilter to prevent an error under a condition, this in the beforeAction event, I try to do a redirect, but it doesn’t work. What I don’t understand is that in the end the filter lets the Action of the controller pass ignoring the Redirect.
class ActionIsIdentidadFilter extends ActionFilter
{
public function beforeAction($action)
{
if(1==1) //Only for this example
return $this->owner->redirect(['/site/no-identity']);
// I've tried with Yii::$app->getResponse()->redirect(['/site/no-identity']);
return parent::beforeAction($action);
}
}