I use yii2 framework in my application and I have a table named objects in my SQL database
"objects" ( object_id , object_typeID , ... )
But we have some objects that have special fields and user should be able to add custom fields to objects form
My solution is create a new table named object-type-"index" for each new objects that have custom fields!
But how should I automatically create custom form for each object-type-"index" tables? Can I use gii module to generate automatic forms?
For custom fields you should have two additional tables for all "objects":
[object_field_value]
object_id | field_id | value
2 | 5 | Yes
2 | 6 | Blue
3 | 5 | No
[object_field]
ID | name | [other attributes for field]
5 | Colorful? |
6 | Base color |
That way you can match object with it's all fields