mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge pull request #1348 from thomseddon/consistent-timestamps
Unify modified/created times. Both the created/updated timestamps will reflect the same point in time now.
This commit is contained in:
commit
d52c401ff2
1 changed files with 2 additions and 1 deletions
|
@ -1662,13 +1662,14 @@ class Model extends Object implements CakeEventListener {
|
|||
}
|
||||
|
||||
$db = $this->getDataSource();
|
||||
$now = time();
|
||||
|
||||
foreach ($dateFields as $updateCol) {
|
||||
if ($this->hasField($updateCol) && !in_array($updateCol, $fields)) {
|
||||
$default = array('formatter' => 'date');
|
||||
$colType = array_merge($default, $db->columns[$this->getColumnType($updateCol)]);
|
||||
if (!array_key_exists('format', $colType)) {
|
||||
$time = strtotime('now');
|
||||
$time = $now;
|
||||
} else {
|
||||
$time = call_user_func($colType['formatter'], $colType['format']);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue