Skip to content

[MapRequestPayload] Allow usage of expressions for defining validation groups #58273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: 7.4
Choose a base branch
from
Prev Previous commit
Next Next commit
small fixes
  • Loading branch information
Brajk19 committed Mar 23, 2025
commit 76a356ecf5b822b8ff977cc5cbf798d2ac014a08
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,8 @@ private function mapUploadedFile(Request $request, ArgumentMetadata $argument, M
*
* @return string|GroupSequence|array<string>|null
*/
private function resolveValidationGroups(Expression|string|GroupSequence|array|null $validationGroups, ControllerArgumentsEvent $event): string|GroupSequence|array|null {
private function resolveValidationGroups(Expression|string|GroupSequence|array|null $validationGroups, ControllerArgumentsEvent $event): string|GroupSequence|array|null
{
if ($validationGroups instanceof Expression) {
return $this->resolveExpression($validationGroups, $event);
}
Expand All @@ -255,8 +256,6 @@ private function resolveValidationGroups(Expression|string|GroupSequence|array|n
}

return array_map(fn ($group) => $group instanceof Expression ? $this->resolveExpression($group, $event) : $group, $validationGroups);
}

}

private function resolveExpression(Expression $expression, ControllerArgumentsEvent $event): string
Expand Down