php - symfony 2 redirect if user is logged in and wants to call /login -


i've following problem in symfony 2 application.

when user logged in still has access route /login. best way avoid case ?

i tried redirect user if wants login, didn't works, thought.

public function loginaction() {    if (!$this->get('security.context')->isgranted('role_user')) {        // not logged in        ...        code        ...        ..        .     } else {         // logged in          $this->redirect($this->generateurl('hereismyroutename'));     } } 

i solved on own, problem have return redirect.

return $this->redirect($this->generateurl('hereismyroutename')); 

Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -