QuickTip: Turn symfony's web profiler debug bar on or off

Check out your config_dev.yml and you will notice a special section over there [sourcecode language=”shell”] web_profiler: toolbar: true intercept_redirects: false [/sourcecode] You can turn the debug bar on or off anytime by changing the value of toolbar in this web_profiler section. If you want to turn debug bar off for a specific controller action, you … Continue reading QuickTip: Turn symfony's web profiler debug bar on or off

How to login a user programatically in Symfony2

Sometime, you may need to log in an user manually from code, instead of generic form based log in. To do it, you need to use Two Security component “UsernamePasswordToken” and “InteractiveLoginEvent”. We will also use another exception object “UsernameNotFoundException” if the user is not found. [sourcecode language=”php”] use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; use Symfony\Component\Security\Core\Exception\UsernameNotFoundException; [/sourcecode] … Continue reading How to login a user programatically in Symfony2