mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
FIX LastEdited no longer updated on skipped writes
This commit is contained in:
parent
1ae07ac2a3
commit
eb80a5f9e8
@ -1377,6 +1377,12 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
||||
// Check changes exist, abort if there are none
|
||||
$hasChanges = $this->updateChanges($isNewRecord);
|
||||
if($hasChanges || $forceWrite || $isNewRecord) {
|
||||
|
||||
// Ensure Created and LastEdited are populated
|
||||
if(!isset($this->record['Created'])) {
|
||||
$this->record['Created'] = $now;
|
||||
}
|
||||
$this->record['LastEdited'] = $now;
|
||||
// New records have their insert into the base data table done first, so that they can pass the
|
||||
// generated primary key on to the rest of the manipulation
|
||||
$baseTable = ClassInfo::baseDataClass($this->class);
|
||||
@ -1396,12 +1402,6 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
||||
$this->invokeWithExtensions('onAfterSkippedWrite');
|
||||
}
|
||||
|
||||
// Ensure Created and LastEdited are populated
|
||||
if(!isset($this->record['Created'])) {
|
||||
$this->record['Created'] = $now;
|
||||
}
|
||||
$this->record['LastEdited'] = $now;
|
||||
|
||||
// Write relations as necessary
|
||||
if($writeComponents) $this->writeComponents(true);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user