CodeIgniter Forums
DataMapper's Automated Timestamps can't work - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: DataMapper's Automated Timestamps can't work (/showthread.php?tid=12910)



DataMapper's Automated Timestamps can't work - El Forum - 11-04-2008

[eluser]sankai[/eluser]
I try update my data and it's success,but the fields "updated_on" don't be auto update!
I had setting in model class follow topics "Automated Timestamps" guide as
Code:
var $created_field = 'created_on';
var $updated_field = 'updated_on';
var $local_time = TRUE;
It's seem to be lose efficacy.

Is any more options to setting or notes? :-S


DataMapper's Automated Timestamps can't work - El Forum - 11-04-2008

[eluser]sankai[/eluser]
[quote author="sankai" date="1225846368"]I try update my data and it's success,but the fields "updated_on" don't be auto update!
I had setting in model class follow topics "Automated Timestamps" guide as
Code:
var $created_field = 'created_on';
var $updated_field = 'updated_on';
var $local_time = TRUE;
It's seem to be lose efficacy.

Is any more options to setting or notes? :-S[/quote]


I try to debug by myself.
The datamapper version is 1.4.5
I find it on line 428 in libraries/datamapper.php

source:
Code:
if ($field == $this->updated_field)
{
    // Update updated datetime
    $this->{$field} = $timestamp;
}
fixed:
Code:
if ($field == $this->updated_field)
{
    // Update updated datetime
    $this->{$field} = $timestamp;
    // Register changed existing
    array_push($this->changed_existing,$field);
}