Commit 721e2e3e authored by Marc Egger's avatar Marc Egger
Browse files

make better exception

parent 91cf36a5
Pipeline #3951 failed with stages
in 3 minutes and 13 seconds
......@@ -622,6 +622,7 @@ class FormAsFile
// Remove columns: id, name, fileStats
$formId = $form[F_ID];
$formName = $form[F_NAME];
unset($form[F_ID]);
unset($form[F_NAME]);
unset($form[F_FILE_STATS]);
......@@ -631,12 +632,12 @@ class FormAsFile
$formElements = $database->sql($sql, ROW_REGULAR, $parameterArray); // array(array(column name => value))
// Translate container references (id to name) and remove all id columns
$containerNames = array_reduce($formElements, function ($result, $formElement) {
$containerNames = array_reduce($formElements, function ($result, $formElement) use ($formName) {
if ($formElement[FE_CLASS] === FE_CLASS_CONTAINER) {
$containerName = $formElement[FE_NAME];
if (in_array($containerName, $result) || $containerName === '') {
throw new \UserFormException(json_encode([
ERROR_MESSAGE_TO_USER => 'Duplicate container names.',
ERROR_MESSAGE_TO_USER => "Duplicate container names in form $formName",
ERROR_MESSAGE_TO_DEVELOPER => "Container Form Elements must have a unique and nonempty name. Container name: '$containerName'."]),
ERROR_FORM_INVALID_NAME);
}
......
Supports Markdown
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