Slide 11
Slide 11 text
02-02-2013
Update
88
Create*
23
Delete
88
90
92
question[]=15-88&question[]=23 ...
qid qid
rid
Existing
88
90
92
*Always referring to question id.
Drupal meetup - Lisbon
Notes:
And with this we know which relations to create and to
update. The only thing that we need to take into
account is that the ids in the insert table refer to
questions. The other ids are always relations.
To know which relations to delete we need to load all
the relations for that survey. And now we get the
difference between existing relations and the ones to
be updated.
Since all the relations are always updated, if a relation
is not present to be updated means that it was not
present in the serialization meaning that the user
removed it.
Now we have all the data that we need and using the
relation's api we just create, save and delete what
we need.