Thanks for your reply Mark.

The logic in my app is working fine, the issue I have is that when I
insert a row into my table table1_table2 all the weights get adjusted.
eg:

table1_id       table2_id        weight
1               1               1
1               2               2
1               3               3
2               4               1
2               5               2
2               6               3

Now if I insert
1               7               2

I get

table1_id       table2_id        weight
1               1               1
1               2               3
1               3               4
2               4               2
2               5               3
2               6               4
1               7               2

Note, all the weights have incremented, but I only want the weights
for table1_id == 1 to increment.

any thoughts?



On Dec 18, 11:42 pm, mark_story <[email protected]> wrote:
> HABTM is not relation you are looking for I think, I usually model
> this with a table_1 hasMany joinTable, table_2 hasMany joinTable, and
> joinTable belongsTo both table_1 and table_2.
>
> -Mark
>
> On Dec 18, 3:16 am, Colin <[email protected]> wrote:
>
> > Hi All,
>
> > I have a model for HABTM like so:
>
> > id
> > table1_id
> > table2_id
> > weight
> > created
> > modified
>
> > I only want the weight to be unique for table1_id, but when I do an
> > insert at the moment, all the weights in the table are changed
> > automagically.
>
> > Is there a way to tell cake to only increment the weight where
> > table1_id is the same?
>
> > Any pointers most welcome
>
> > Thanks in advance,
>
> > Colin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to