$batch = array();
foreach(Input::post('threads') as $threads)
{
$thread = new Model_Thread(array(
'title' => $threads['title'],
'cat' => $threads['cat'],
'date' => time(),
));
//related models
$batch[] = $thread;
}
foreach($batch as $thread)
{
$thread->save()
}
Harro Verton wrote on Saturday 11th of June 2011:Yes, the ORM is made for object interaction. Don't try to force all database I/O through an ORM model. In some cases it's a lot more efficient to simply use DB calls. If you insist, then yes, you'll have to create ORM model objects in a loop, and save them one at the time.
It looks like you're new here. If you want to get involved, click one of these buttons!