6.0.0-git
2019-08-18

[#14803] Horde_Rdo_Mapper sets created_at, forgets updated_at
Summary Horde_Rdo_Mapper sets created_at, forgets updated_at
Queue Horde Framework Packages
Type Bug
State Feedback
Priority 1. Low
Owners
Requester birnbacs (at) gmail (dot) com
Created 2018-04-03 (502 days ago)
Due 05/01/2018 (474 days ago)
Updated 2019-04-07 (133 days ago)
Assigned 2019-04-07 (133 days ago)
Resolved
Milestone
Patch No

History
2019-04-07 00:25:33 Michael Rubinsky State ⇒ Feedback
 
2019-04-07 00:25:26 Michael Rubinsky Comment #5 Reply to this comment
I am surprised the bug is still open. Please kindly see enclosed 
file for a fix for both problems. The amended lines are marked with 
this ticket's number 14803
Wouldn't this depend on the column type you created in the database?

Not saying it shouldn't be a datetime, but changing this to *assume* 
it's a datetime field is a BC break.
2019-04-05 13:23:01 birnbacs (at) gmail (dot) com Comment #4
New Attachment: Mapper[1].php Download
Reply to this comment
I am surprised the bug is still open. Please kindly see enclosed file 
for a fix for both problems. The amended lines are marked with this 
ticket's number 14803
2018-04-23 21:03:44 birnbacs (at) gmail (dot) com Comment #3 Reply to this comment
I found another little bug in Mapper.php. Function create (line 343 
ff.) should also use the Horde_Date object:

     public function create($fields)
     {
         // If configured to record creation and update times, set them
         // here. We set updated_at to the initial creation time so it's
         // always set.
         if ($this->_setTimestamps) {
             $time = time();
             $fields['created_at'] = new Horde_Date(time()); //$time;
             $fields['updated_at'] = new Horde_Date(time()); //$time;
         }
2018-04-13 09:59:27 birnbacs (at) gmail (dot) com Comment #2
New Attachment: Mapper.php Download
Reply to this comment
I was able to fix the described misbehaviour.
Please note the change around line 408 of enclosed Mapper.php:

[...]
         // If configured to record update time, set it here.
         if ($this->_setTimestamps) {
             //$fields['updated_at'] = time();
             $fields['updated_at'] = new Horde_Date(time());
         }
[...]

2018-04-03 22:42:18 birnbacs (at) gmail (dot) com Comment #1
Type ⇒ Bug
State ⇒ Unconfirmed
Priority ⇒ 1. Low
Summary ⇒ Horde_Rdo_Mapper sets created_at, forgets updated_at
Due ⇒ 2018-05-01
Queue ⇒ Horde Framework Packages
Milestone ⇒
Patch ⇒ No
Reply to this comment
I am using an RdoMapper on a table created with $t->timestamps() on a 
Horde_Db_Migration_Base object. Columns created_at and updated_at are 
created right away in the backend.

According to Mapper.php (line 342 ff.), both fields should be set to 
the current timestamp on create(). According to lines 388 ff. 
updated_at should be set on update(). While created_at functions all 
right, updated_at remains set to 0000-00-00 00:00:00. No change on 
creation or update.

Saved Queries