CodeIgniter Forums
DMZ - Saving multi model relationships (help!!!) - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: DMZ - Saving multi model relationships (help!!!) (/thread-34230.html)



DMZ - Saving multi model relationships (help!!!) - El Forum - 09-23-2010

[eluser]prestondocks[/eluser]
Hi All,

I think I have my head around how multi model relationships work from reading the advanced relationships userguide, however it does not seem to tell you how to save the extra relationships.

I have two models User and Task

I can save a standard relationship with $t->save($u);

but now have the need to save a relationship for a task_worker

My relationship table now has the following fields

ID
user_id
task_id
task_worker_id
user_worker_id

I have updated the model to store the relationship as an array in the model (it will be a many to many relationship)

Pleaes could someone tell me how to save this second relationship?


DMZ - Saving multi model relationships (help!!!) - El Forum - 09-23-2010

[eluser]prestondocks[/eluser]
I sorted out the problem myself. The solution can be found here (http://www.overzealous.com/dmz/pages/save.html) under the section saving advanced relationships.

Hope this helps someone else.

Thanks