if (!$this->getUser()->isAuthenticated())
{
$this->redirect('login/index');
}
i would like add this code for many actions in different modules. I must copy this code for each action? I would like make somethings:
//module
class Invite
public function executeIndex {
sfConfig:get('redirect');
}
class Home
public function executeIndex {
sfConfig:get('redirect');
}
public function executeShow {
sfConfig:get('redirect');
}
if can’t be in different modules, although it might in a single?
What you need is a filter. See here