This should be the feature of the Yii Gii.
1- Select tables which have the relation with other Tables
2- Set the Type of the Relation
3- Set which Column is Related with Which Column
4- Can Process it Using models created by CURD.
Basic Logic of the required feature is
[*] Select the Main Database table
- It will list up all the fields of the selected Table
[*]We have the option to select the relation for the table if it does
[*] If the table has a relation with other tables then
[*] List up the tables
[*] Select the Table
[*] List up the fields
[*] Select the Column/field
[*] Select the type of relation
[*] Generate the CURD functions/models