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 developped a bundle.
You can find it at https://github.com/Spomky-Labs/RoleHierarchyBundle