many-to-many relationship: adding existing doesn't work
Posted: Mon Apr 26, 2010 3:22 pm
Hi All.
I'm writing another Xataface application after quite some time away from it, so I'm probably making a very simple mistake, but I can't see it...
I've got a many-to-many relationship I have a table called "groups" and another called "packages", and a group_contents table to link them. I have a relationships.ini for the groups table that looks like :-
The relationship shows up in the UI as I expect, and if I add a new record, it all works properly - the package record is updated in the package table correctly, and the relationship to the group is set correctly.
However, if I add an existing record, it fails - the package id is set to zero, rather than the id for the package itself. The SQL log shows :-
...which is clearly wrong.
I've tried assorted relationships.ini files for the other tables - nothing seems to change this behaviour.
Can anyone give me a hint as to what I'm doing wrong?
Thanks!
Vic.
I'm writing another Xataface application after quite some time away from it, so I'm probably making a very simple mistake, but I can't see it...
I've got a many-to-many relationship I have a table called "groups" and another called "packages", and a group_contents table to link them. I have a relationships.ini for the groups table that looks like :-
- Code: Select all
packages.id = group_contents.package_id
group_contents.group_id = "$id"
The relationship shows up in the UI as I expect, and if I add a new record, it all works properly - the package record is updated in the package table correctly, and the relationship to the group is set correctly.
However, if I add an existing record, it fails - the package id is set to zero, rather than the id for the package itself. The SQL log shows :-
- Code: Select all
22179 Query INSERT INTO `group_contents` (`group_id`,`package_id`,`type`) VALUES ('1','__packages__auto_increment__','1')
...which is clearly wrong.
I've tried assorted relationships.ini files for the other tables - nothing seems to change this behaviour.
Can anyone give me a hint as to what I'm doing wrong?
Thanks!
Vic.