add some validation to row edit, better handle setting null cols with empty

This commit is contained in:
2018-08-05 18:45:11 +02:00
parent 06fb01d146
commit 6cfd5aa7e9
13 changed files with 164 additions and 90 deletions
+6 -2
View File
@@ -325,8 +325,12 @@ class Changeset
foreach ($newVals as $colId => $value) {
if (starts_with($colId, '_')) continue; // internals
if (!isset($origRow->$colId) || $value != $origRow->$colId) {
$updateObj[$colId] = $cols[$colId]->cast($value);
$col = $cols[$colId];
$value = $col->cast($value);
$origValue = $col->cast(isset($origRow->$colId) ? $origRow->$colId : null);
if ($value !== $origValue) {
$updateObj[$colId] = $value;
}
}