Skip to content

Commit

Permalink
Fixed issue with regexp parsing values from error message
Browse files Browse the repository at this point in the history
  • Loading branch information
juniwalk authored Sep 23, 2024
1 parent adb703f commit ec8c480
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/AbstractForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,13 +357,9 @@ protected function handleUniqueConstraintViolation(
return;
}

$fields = array_combine(
Strings::split($matched['field'], '/,\s?/'),
Strings::split($matched['value'], '/,\s?/'),
);

$fields = array_fill_keys(Strings::split($matched['field'], '/,\s/'), null);
$fields = Arrays::walk($fields, fn($value, $field) =>
yield $fieldMap[$field] ?? Format::camelCase($field) => $value
yield $fieldMap[$field] ?? Format::camelCase($field) => $form->getComponent($field, false)?->getValue() ?? $value
);

$fieldKey = implode('-', array_keys($fields));
Expand Down

0 comments on commit ec8c480

Please sign in to comment.