Welcome Guest, Not a member yet? Register   Sign In
Merging/Updating 2 sets of Items with Datamapper
#2

[eluser]WanWizard[/eluser]
There is no automatic way.

What I usually do is to add a method to my model for dealing with this.

The method takes an array with id's that need to be related (which could be supplied by your checkboxes).It then deletes all relations from the relationship table using a standard $this->db->delete query, and creates the new relations using the array passed.

I use Innodb, and have encapsulated this in a transaction to avoid consistency issues.


Messages In This Thread
Merging/Updating 2 sets of Items with Datamapper - by El Forum - 03-06-2012, 02:38 AM
Merging/Updating 2 sets of Items with Datamapper - by El Forum - 03-06-2012, 04:37 AM
Merging/Updating 2 sets of Items with Datamapper - by El Forum - 03-06-2012, 04:38 AM



Theme © iAndrew 2016 - Forum software by © MyBB