Bug Report #3172

Documentation example on $_created_column incorrect

Added by Austin B almost 4 years ago. Updated almost 4 years ago.

Status:ClosedStart date:08/12/2010
Priority:LowDue date:
Assignee:Isaiah DeRose-Wilson% Done:

0%

Category:Modules:ORM
Target version:v3.0.8
Resolution:fixed Points:

Description

If you check out the readme file for the ORM (http://github.com/kohana/userguide/blob/master/guide/tutorials.orm.md) and scroll down to the section on "Using Updated and Created" columns you will see the following examples:

// date_created is the column used for storing the creation date. Use format => TRUE to store a timestamp.
protected $_created_column = array('date_created', 'format' => TRUE);

// date_modified is the column used for storing the modified date. In this case, a string specifying a date() format is used.
protected $_updated_column = array('date_modified', 'format' => 'm/d/Y');

Which are wrong and should be:

// date_created is the column used for storing the creation date. Use format => TRUE to store a timestamp.
protected $_created_column = array('column' => 'date_created', 'format' => TRUE);

// date_modified is the column used for storing the modified date. In this case, a string specifying a date() format is used.
protected $_updated_column = array('column' => 'date_modified', 'format' => 'm/d/Y');

I found this out the hardway when my ORM model threw a invalid sql error because the column name was not being set as the examples had it. I had to look into the Kohana_ORM class (Lines 865-866) to find out what the proper format was for the array. Not a huge deal but thought I would make a ticket about it while I had it on my mind.

Associated revisions

Revision 8b00321e
Added by Isaiah DeRose-Wilson almost 4 years ago

Updated the $_created_column/$_updated_column examples in the ORM tutorial. Fixes #3172

History

#1 Updated by Woody Gilk almost 4 years ago

  • Target version set to v3.0.8

#2 Updated by Isaiah DeRose-Wilson almost 4 years ago

  • Status changed from New to Closed
  • Assignee changed from John Heathco to Isaiah DeRose-Wilson
  • Resolution set to fixed

Thanks! Fixed in 8b00321e6f6...

Also available in: Atom PDF