Re: Multiple parent/child relations between 2 tables [message #1356 is a reply to message #1355] |
Thu, 29 May 2008 15:15 |
AJM
Messages: 2363 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
When you say that the "translation between field names in different tables was done by the dict file" you are mistaken. This can only be done internally within a table object when it is creating the 'ON (...)' clause of a JOIN within a SELECT statement.
However, the same logic does not apply when a field name is passed into a table object from an external source because there is nothing to identify which relationship should be used, only the field name itself. There is no way to identify which table the input field comes from, which means that there is no way to identify the relationship, which in turn means that there is no way that the framework knows how to convert the input name to a different name so that it can be applied to the current table.
When I said that "this is done by custom code as it cannot be done automatically by the framework" I did not mean custom code within the '*.dict.inc' file as this does not contain customisable code - it is generated from the contents of the data dictionary. I meant custom code within a table class, as in the '_cm_pre_getData()' method of file 'mnu_menu_snr.class.inc'.
The 'mnu_menu' table contains two foreign keys, named 'menu_id' and 'task_id_nr', but the field name which is passed in is named 'task_id'. This has to be changed to one or other of the two different names, but which one? The framework cannot do it automatically, so it has to be done manually.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|