This post has NOT been accepted by the mailing list yet.
After reading lots of blogs and documentation i found out that getControllerConfig() is the function which can perform pre -instantiation logic before the controller gets constructed. All i wanted to do is bascially
when ever some one enter on the
/Dashboard/add etc etc.
I want to check $auth->hasIdentity() then display the contents otherwise redirect the user to login page.
All the solutions i have come across even the ZfcUser they are checking the $auth->hasIdentity() inside the
controller actions which i do not want to do further more ZfcUser is too much for my small redirect problem. I want to handle this from the top level and redirect the user.
Unfortunately inside the getControllerConfig() i can not do redirect because the Event object has not yet been passed to it so no use.
I also overloaded the onDispatch inside my DashboardController.php but it does not work as well niether i can do it on preDispatch inside the Module.php
Can some one please throw a small code snippet or deeper explanation of how to achieve it in zf2.
Below is my Module.php