Symfony2: Create a logout link
I created the link this way: (I use TWIG)
<a href="{{ path('user_logout') }}">Logout</a>
And in my "UserBundle", in the routing.yml file added
user_logout: pattern: /logout
When you are using the FOSUserBundle you can use
{{ path('fos_user_security_logout') }}