Hi,
I was wondering what the best method is to edit a 'has many through' relation with a form. Let's say I have a bunch of users that can belong to multiple categories.
The form would have some checkboxes like this:
<input type="checkbox" name="category_ids" value="1" />
<input type="checkbox" name="category_ids" value="2" />
Then in my controller I could do something like:
// dump all relations
DB::delete('users_categories')->where('user_id','=',$user->id)->execute();
// add new relations
foreach (explode(',', $_POST['category_ids']) as $category)
$user->add('category', ORM::factory('category', $category))
But this looks too complicated to me (also because I have more than one 'has many through' relations). Is there an easier / better way to accomplish this using kohana orm? :)