/** * @param array $oldValues associative array (fieldNames => fieldValues) of old values * @param array $newValues associative array (fieldNames => fieldValues) of new values * @param IDataset|Dataset $dataset dataset where changes between old and new values must be written */ protected function WriteChangesToDataset($oldValues, $newValues, Dataset $dataset) { foreach ($newValues as $fieldName => $fieldValue) { if ($dataset->DoNotRewriteUnchangedValues()) { if (!isset($oldValues[$fieldName]) || $oldValues[$fieldName] != $fieldValue) { $dataset->SetFieldValueByName($fieldName, $fieldValue); } } else { $dataset->SetFieldValueByName($fieldName, $fieldValue); } } }