Re: LIST3 linked from LIST1 [message #4818 is a reply to message #4816] |
Thu, 09 July 2015 16:17 |
rafs
Messages: 69 Registered: May 2015
|
Member |
|
|
AJM wrote on Thu, 09 July 2015 05:44If the are any differences between the name of the primary key in the parent table and the name of the corresponding foreign key inb the child table, then you must convert the field name manually in your code as the framework cannot do this automatically.
I am following the convention that every table's primary key is called 'id', and every table's foreign key is called <referenced-table>_id. This is the convention that I picked up from CakePHP, and probably RoR. This convention was a requirement for the project. So, for example, packages has many files (WHERE packages.id = files.package_id), and files have many lines (WHERE files.id = lines.file_id).
The parent to child part works when using this convention, but that the child to grandchild linking does not.
[Updated on: Thu, 09 July 2015 16:50] Report message to a moderator
|
|
|