Commit e3afd64a authored by Simon Gadient's avatar Simon Gadient
Browse files

[IMP] Static argument parameter instead of default

Don't support default value but use it as static value. It's dangerous
if it can be overwritten by parameter. Additionally, it might have
problem with type casting.

refs KIME-4583
parent 5e8c8d86
Loading
Loading
Loading
Loading
+5 −2
Changes for Classes/WE/SpreadsheetImport/FrontendMappingService.php: 5 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -46,8 +46,11 @@ class FrontendMappingService {
		if (is_array($contextArguments)) {
			foreach ($contextArguments as $contextArgument) {
				$name = $contextArgument['name'];
				$default = isset($contextArgument['default']) ? $contextArgument['default'] : NULL;
				$arguments[$name] = $request->hasArgument($name) ? $request->getArgument($name) : $default;
				if (isset($contextArgument['static'])) {
					$arguments[$name] = $contextArgument['static'];
				} else {
					$arguments[$name] = $request->hasArgument($name) ? $request->getArgument($name) : NULL;
				}
			}
		}
		return $arguments;
+1 −3
Changes for Classes/WE/SpreadsheetImport/SpreadsheetImportService.php: 1 added line, 3 removed lines.
Original line number Diff line number Diff line
@@ -355,12 +355,10 @@ class SpreadsheetImportService {
					} else {
						$value = $arguments[$name];
					}
				} else {
					$value = array_key_exists('default', $contextArgument) ? $contextArgument['default'] : NULL;
				}
					$setter = 'set' . ucfirst($name);
					$object->$setter($value);
				}
			}
		}
	}
}