Bug Report #4687

Database default values not available after create

Added by Mathias Brodala over 1 year ago.

Status:NewStart date:01/16/2013
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-
Resolution: Points:1

Description

To insert a record via Kohana's ORM one can use the ORM::create method. However, that method only inserts the data without performing an additional query afterwards.

This yields the issue that default values defined in the database (e.g. CURRENT_TIMESTAMP) are not picked up and thus not available in the ORM object.

A possible fix is to perform a query right after the DB::insert call using the primary key value available from that call and update the object data accordingly.

Also available in: Atom PDF