Commit e3afd64a authored by Simon Gadient's avatar Simon Gadient

[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
......@@ -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;
......
......@@ -355,11 +355,9 @@ class SpreadsheetImportService {
} else {
$value = $arguments[$name];
}
} else {
$value = array_key_exists('default', $contextArgument) ? $contextArgument['default'] : NULL;
$setter = 'set' . ucfirst($name);
$object->$setter($value);
}
$setter = 'set' . ucfirst($name);
$object->$setter($value);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment