Skip to content

Commit

Permalink
Move the assignment and cleaning before creating the validator
Browse files Browse the repository at this point in the history
  • Loading branch information
alainvd committed Apr 22, 2024
1 parent c1c8b7e commit e10519e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions app/Services/GroupedSubmissionsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public function sanitizePayload(
$statement['decision_visibility'] ?? [], true);
$content_type_other_required = in_array('CONTENT_TYPE_OTHER', $statement['content_type'] ?? [], true);


$statement['territorial_scope'] = $this->european_countries_service->filterSortEuropeanCountries($statement['territorial_scope'] ?? []);

// Create a new validator instance for each statement
$validator = Validator::make($statement,
Expand All @@ -144,8 +144,6 @@ public function sanitizePayload(
$errors['statement_' . $index] = $validator->errors()->toArray();
}

$statement['territorial_scope'] = $this->european_countries_service->filterSortEuropeanCountries($statement['territorial_scope'] ?? []);

try {
$payload['statements'][$index] = $validator->validated();
} catch (ValidationException) {
Expand Down

0 comments on commit e10519e

Please sign in to comment.