M
M
MIK Ek2016-06-07 15:16:15
MySQL
MIK Ek, 2016-06-07 15:16:15

How to implement a field reference (UPD: "Entity-attribute-value model") in Yii2?

MySQL DB.
The task is that: There is a table USER storing only fields which are at all users (id, login).
There is a USER_PROPERTY table that stores the rest of the user properties in the format (user_id, property_id, value).
And there is a PROPERTYS table in which there is a list of fields for the group and from the description (id, group_id, name, description, lable).
The task is to form a model that will contain all the properties that relate to this user.
1) Is this decision rational? If there are 10 different user groups and each can have up to 10 unique (used only for that group) fields.
2) How to call it humanly for search?
3) Can this be nicely organized in yii2? (if there is somewhere, I will be grateful for the link)
4) If it is impossible to do this somehow in yii2, then an example of a SQL query to collect all the user's properties in 1 line.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Kirill Arutyunov, 2016-06-07
@arutyunov

entity-attribute-value model

A
Anton, 2016-06-07
@karminski

MIKEk8 This methodology (EAV) is implemented in 1C-Bitrix (Information Blocks). You can take their structure as a basis. And it is better to write the implementation in Yii yourself.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question