6.0.0-git
2018-12-16

[#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 Unconfirmed
Priority 1. Low
Owners
Requester birnbacs (at) gmail (dot) com
Created 2018-04-03 (257 days ago)
Due 05/01/2018 (229 days ago)
Updated 2018-04-23 (237 days ago)
Assigned
Resolved
Milestone
Patch No

History
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