I am not 100% sure that I understand what you mean but yes yu can save multiple relations at the same time.
Like this:
$s = new Section();
$s->where_in('section', $array_with_sections_ids)->get();
$v->save(array($u, $s->all, $q));
Question
Working on a site where a user can add videos. Each video can be in many sections. It can also have many questions. Video has a one-to-many relationships with both the question and section classes.
I'm getting the section and video classes like this:
$s = new Section();
$s->where('section', $this->post->section)->get();
then saving like this:
$v->save($u, $s, $q);
where $v is a video object, $u is a user object and $q is a question object.
I want to allow the user to POST multiple questions and sections. How do I save those relationships. Should $s and $q be arrays of objects?
Solution
I am not 100% sure that I understand what you mean but yes yu can save multiple relations at the same time.
Like this:
$s = new Section();
$s->where_in('section', $array_with_sections_ids)->get();
$v->save(array($u, $s->all, $q));
OTHER TIPS
You use different tables in your database. Like Video, Question and VideoQuestion where you store the video ID with the different Question id's
Then VideoExample would look like:
| video_id | question_id |
--------------------------
| 1 | 1 |
| 1 | 5 |
...
for inserting this data, first insert the video and get its ID with
$videoId = $this->db->insert_id()
Do the same for your question and you've got your ID's ;) The same for the other tables and you're done. Good Luck!