I want to get the Role of the user currently logged. Because I want to show that in my navbar can somebody help me?
My question is about how to get the current role
If I remember well, you can get roles in twig by doing {{ app.user && app.user.roles }} but you will get an array of roles.
{{ app.user && app.user.roles }}
Hope it helps.
you can get from current user,when we get the role,it returns array of roles
$user = $this->getUser(); $role = $user->getRoles();
in twig
{{app.user.roles}}
If I remember well, you can get roles in twig by doing
{{ app.user && app.user.roles }}but you will get an array of roles.Hope it helps.