I'm trying to write a authorization system combining with the Symfony itself. My logic is like this:
- there is a
Usertable who holds the system users. - there is a
Roletable who take care of roles. - there is a
Permissiontable who keeps the Each part of websites' permission. - there is a
User_Roletable which tells us which user is is which Role. - there is a
Role_Permissiontable which define Each Role's permission.
I have created the tables in the database and their relationships. and imported them to Symfony ( created entity ).
and now the problem is:
/**
* @inheritDoc
*/
public function getRoles()
{
return array('ROLE_TEST');
}
How can I load each user's roles in the roles array?