=== Group ===
id
name
=== Member ===
id
group_id (FK)
firstname
lastname
membersince
Here I have used multimodel to get the values of Member into Group.So here in Group I can easily make create,update and delete for both models in a single form. Now as I am going to only Member model and trying to save something it is showing error like this
CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`tbl_groupapp`.`tbl_member`, CONSTRAINT `FK_member_group` FOREIGN KEY (`group_id`) REFERENCES `tbl_group` (`id`) ON DELETE CASCADE). The SQL statement executed was: INSERT INTO `tbl_member` (`firstname`, `lastname`, `gender`, `membersince`) VALUES (:yp0, :yp1, :yp2, :yp3)
Then I found that Member model wants to save its group_id which I am not saving.So I made changes in my member’s form file and I changed my code like this
But here I am getting all the ids as dropdown list.Now I want that the field for group_id will be hidden and it will take its only corresponding id from the Group model.So that one will use only Member model without putting any attributes for group_id,it will take the id from the corresponding table.So how to do this?Any help and suggestions will be highly appriciable.