In my project I need to store role hierarchy in database and create new roles dynamically. In Symfony2 role hierarchy is stored in security.yml by default. What
security.yml
I hope this will help you.
function getRoles() { // return array(1=>'ROLE_ADMIN',2=>'ROLE_USER'); return array(new UserRole($this)); }
You can get a good idea from, Where to define security roles?
http://php-and-symfony.matthiasnoback.nl/ ( 2012 July 28 )