Hi all,
I have been writing to ask help about understanding the relations in the models. Let me give you a little background what problem I am facing and trying to resolve:
I have one main table e.g MainTable in which I have a cloumn StudentID as a primary key. Then I have 10-15 different tables which have information about a particular student in table MainTable. They all have StudentID column as foreign key. Some of them will have only one row of record of against a particular StudentID in MainTable. Some of them will have multiple rows against StudentID in MainTable.
Let me write once again that StudentID is in all tables as foreign key but primary key in MainTable.
I created Models for all the database table. When it came to creating CRUD, it only performed CRUD operation for MainTable but it does not perform CRUD operation for the rest of the tables and give following error.
‘Primary key is not defined in the table Class.’
I was assuming that the Gii CRUD will generate files for all models but hopeless. Now I have searched a little bit on forum as well as on google but all in vain.
Finally, I need a solution to create controller and view files automatically as it created for MainTable to save lots of hassle of writing code(however i will be ammending the code to suit my needs).
[list=1]
[*]I need to know if there is a solution to this particular problem. If yes, how.
[*]I need to understand the relationships as a whole
[*]I need a link/source where that can help to learn more about relationships
[/list]
I would appreciate a quick response of you guys in this regard.
Thanking you in advance.