I'm working on one project for that i need solution for users & roles both are different entities.
user entity
user
id
fname
lname
email
role entity
roles
id
roles
user_roles entity
id
user_id
role_id
You need to create Role class which implements RoleInterface, and add it to your User class with ManyToMany relationship, and return the array of roles in your getRoles() method, that's it.