Skip to content

Commit 8f4076f

Browse files
author
dereuromark
committed
Fix to include defaults like modified, to avoid updating timestamp.
1 parent c9f290a commit 8f4076f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Model/Behavior/ResetBehavior.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ public function resetRecords(Model $Model, $params = []) {
115115
$fieldList = $params['fields'];
116116
if (!empty($updateFields)) {
117117
$fieldList = $updateFields;
118+
foreach ($defaults['fields'] as $field) {
119+
if (!in_array($field, $fieldList)) {
120+
$fieldList[] = $field;
121+
}
122+
}
118123
}
119124
if ($fieldList && !in_array($Model->primaryKey, $fieldList)) {
120125
$fieldList[] = $Model->primaryKey;
@@ -132,6 +137,7 @@ public function resetRecords(Model $Model, $params = []) {
132137
}
133138
}
134139

140+
dd($fieldList);
135141
$res = $Model->save($row, compact('validate', 'fieldList'));
136142
if (!$res) {
137143
throw new CakeException(print_r($Model->validationErrors, true));

0 commit comments

Comments
 (0)