I want set up Symfony 5 to use "human readable" roles for display purposes. When displaying user information in TWIG I can use {{ user.roles[0] }}. However, this displays (for example) "ROLE_ACCOUNTADMIN" (as is saved against the user in the database), but I would like it to display as "Account Administrator". With Symfony 3 where a user_roles table was used, there was a "role" and a "name" field, but this has been removed. Is it possible to accomplish this in Symfony 5 without having to define / include an array whenever I want to use this?
↧