Hello,
In my experience, I would personally want to manage those relationships
myself. This would include both extraction and saving data. There are
two reasons for this: 1) The queries you'll want to use will likely need
to be tuned to specific use. 2) While Cake might handle the extraction
okay, it may not like saving data in a relationship this complex. I
actually have not had to experience something quite this bad, and I
sympathize with you DB model issues. I have seen worse, but not using
Cake and everything was handmade.
However, other users might have better experiences. I am quite
interested if this might have a semi-automated solution built into the
framework.
Thanks
Fred
[EMAIL PROTECTED] wrote:
> 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
-~----------~----~----~----~------~----~------~--~---