I have a couple tables in a database I'm building a management tool
for that are essentially HABTM (hasAndBelongsToMany) relationships,
but with 3 foreign keys, and a couple of these tables carry extra data
along as well.
A quick note before hand - I did not create the database structure,
and I can't modify it. It's just what I have to live with.
So for example, let's say I have Table A, Table B and Table C - I want
to join all 3 via a table that's something like:
tableA_tableB_tableC
--------------------------------
tableA_id
tableB_id
tableC_id
I also have a couple tables that follow this pattern, but also carry
extra fields, something like:
tableA_tableB_tableC
--------------------------------
tableA_id
tableB_id
tableC_id
extra_field_1
extra_field_2
extra_field_3
I'm thinking I have either 2 options here - somehow figure out how to
get HABTM to work when joining 3 tables (and use a "With" association
for the extra fields in the second example) OR somehow figure out how
to get cake to ignore needing a primary key; then I could basically
setup a model for the table, setup a save array like:
array('tableA_id' => 1, 'tableB_id' => 4, 'tableC_id' => 18) and be
able to save it without cake trying to insert a primary key.
Like I said, I can't modify the database structure at all; I
understand I'll probably be losing some automagicness by using this,
but I don't really care, I don't mind doing some extra coding.
Anyone have any ideas?
- Ryan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---