}
/**
+ * Adds created_at and updated_at columns to the table.
+ */
+ public function timestamps()
+ {
+ return $this->column('created_at', 'datetime')
+ ->column('updated_at', 'datetime');
+ }
+
+ /**
* Use __call to provide shorthand column creation ($this->integer(), etc.)
*/
public function __call($method, $arguments)
abstract class Horde_Rdo_Mapper implements Countable
{
/**
- * If this is true and fields named created and updated are
- * present, Rdo will automatically set creation and last updated
- * timestamps. Timestamps are always GMT for portability.
+ * If this is true and fields named created_at and updated_at are present,
+ * Rdo will automatically set creation and last updated timestamps.
+ * Timestamps are always GMT for portability.
*
* @var boolean
*/
protected $_setTimestamps = true;
/**
- * What class should this Mapper create for objects? Defaults to
- * the Mapper subclass' name minus "Mapper". So if the Rdo_Mapper
- * subclass is UserMapper, it will default to trying to create
- * User objects.
+ * What class should this Mapper create for objects? Defaults to the Mapper
+ * subclass' name minus "Mapper". So if the Rdo_Mapper subclass is
+ * UserMapper, it will default to trying to create User objects.
*
* @var string
*/
// always set.
if ($this->_setTimestamps) {
$time = gmmktime();
- $fields['created'] = $time;
- $fields['updated'] = $time;
+ $fields['created_at'] = $time;
+ $fields['updated_at'] = $time;
}
// Filter out any extra fields.
// If configured to record update time, set it here.
if ($this->_setTimestamps) {
- $fields['updated'] = gmmktime();
+ $fields['updated_at'] = gmmktime();
}
// Filter out any extra fields.
$this->_defaultSort = $sort;
return $this;
}
-
}