I have a problem in my model declaration, in Kohana 3.0.4 with the fields $_created_column and $_updated_column.
The problem is that :
– When I create and update objects from my controllers, the fields in the database corresponding to $_created_column and $_updated_column declaration are modified, according to the current create/modification date, just as it should be.
- When I create and update objects from the models (using
DB::insert,DB::update) (this is the best practice -> handling data operations from models) the fields corresponding to the declaration are NOT updating.
The code for DB::update and DB::insert:
public function add_productimage($zoom, $particular, $thumbnail, $presentation, $product, $order){
$insert_id = DB::insert('product_image', array('zoom','particular','thumbnail','presentation','product','order'))
->values(array($zoom, $particular, $thumbnail,$presentation, $product, $order))
->execute();
return $insert_id;
}
Any idea why?
You are not using ORM for inserts and updates, thus these specific settings are not applied. You use DB Query Builder instead of ORM. Use ORM for inserts / updates and you will be then employing best practice in this case.
By the way: your version of Kohana (
3.0.4) should be easily updated to3.0.12(the most up-to-date in3.0.xline), and this will fix multiple bugs that existed in3.0.4.