Answer the question
In order to leave comments, you need to log in
What is the best way to store multiple users with shared properties?
The essence of the problem:
There are 3 types of users, all 3 types have a set of properties, both common and unique for each, the 2nd and 3rd types also have properties that the first one does not have.
At the moment, there is an idea to form the base as follows (I will attach the diagram later, I am writing from the phone):
Answer the question
In order to leave comments, you need to log in
Property sets are, in fact, roles. Permissions are given to roles, and users can have multiple roles. When checking the user's right to act, you need to check the rights of each of his roles. Very strange question since Yii already has RBAC .
The general - in one table, a miscellaneous - in separate. If user_type_2 and user_type_3 are the same in terms of business logic - in one, otherwise in different ones. The requirements are likely to change and more than once it is cheaper and easier to play it safe.
It is possible to store all the data in one table with the "type" field, where the description of what kind of user it will be will be stored. Somehow so . Thus, you will get rid of the 1 to 1 connection. You can do it with 1 to 1 as you yourself wrote. If you work with "symphony", then the "doctrine" supports both of these options out of the box, see here .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question