Reputation: 31548
I have the hierarchy where there are different categories of users like
I was thinking to put them all in one database table called usertable
But then all categories will their different attributes and then students will also have their parents. SO there will be many to many relationships with own usertable.
But if i make different tables then the login process will be different for different people.
HOw should i go
Upvotes: 1
Views: 136
Reputation: 25295
Since the users will all share common details, like username, password, etc., you only need one user
table for them. You should actually use the FOSUserBundle for this. If different types of users have different sets of unique details, I suggest creating additional tables per user type, and use a foreign key to link users from the user
table to the new table (perhaps named something like parent_profile
, student_profile
, etc.)
In regards to the hierarchy of users, you should be using roles. The Symfony2 docs have all the info you'll need on this subject.
If you need to link users to each other, read up on Doctrine 2's support for one-to-one self referencing and one-to-many self referencing associations. If you use separate entity classes for user user type, you can use the regular one-to-one and one-to-many association techniques.
Hope this helps.
Upvotes: 2