Thursday, January 28, 2010

Re: Multiple table1 FKs referring to single table2 PK

FINALLY, I've sorted through this mess and, once again, it comes back
to understanding the cakePHP conventions.

I had most of the linking relationships right, what was not working
was the choice of names for my foreign-key columns in the intermediate
table. I had columns in the 'mated' table named 'motherID' and
'fatherID' which both referenced the 'id' column in the 'clons' table.
These were being changed by Inflector::underscore and
Inflector::singularize in Model::__generateAssociation to 'mother_i_d'
and 'father_i_d'. Once I renamed these columns to 'mother_id' and
'father_id' in the database and all references to them in the mated
controller, model, and view files and the clons model it all performed
as expected.

If anybody cares, I can post the details of this particular example
for reference/discussion/whatever.

McS.

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: