Reputation: 15
How can I update multiple records in Kohana 3.2's ORM?
For example this:
$menu = ORM::factory('menu');
$menu->where('active','=',1);
$menu->active=2;
$menu->save();
does not work, it inserts a new record.
Thanks
Upvotes: 1
Views: 4542
Reputation: 46
If you don't want to hardcode the table name maybe something like below
DB::update(ORM::factory('menu')->table_name())
->set(array('active' => '2'))
->where('active', '=', '1')
->execute();
Upvotes: 3