is there a way to add multiple records at a time. usually we call it bulk insert. currently i doing the following:
foreach ($datalist as $data)
try {
$this->template_id = $data['template_id'];
$this->notifier_id = $data['notifier_id'];
$this->user_id = $data['user_id'];
$this->date_created= date('Y-m-d h:i:s');
$this->save();
return true;
} catch (Kohana_Exception $e) {
return false;
}
}
$query = DB::insert('company_schedule', array('day', 'work_start', 'work_end', 'week_start', 'week_end', 'company_id')); // create sql request
$query->values(array(
$key, $work_start, $work_end, $week_start, $week_end, $this->id
)); // do it in loop
$query->execute(); // execute