Skip to content

Commit

Permalink
fix: throw a ValidationException
Browse files Browse the repository at this point in the history
  • Loading branch information
mrossard committed Jan 14, 2025
1 parent 5ba7c7c commit 3583931
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -419,10 +419,10 @@ final readonly class MyEntityRemoveProcessor implements ProcessorInterface

public function process(mixed $data, Operation $operation, array $uriVariables = [], array $context = [])
{
$validationErrors = $this->validator->validate($data, groups: ['deleteValidation']]);
if($validationErrors->count() > 0) {
//trigger some error / throw some exception...for example
throw new ConflictHttpException($errors->get(0)->getMessage());
$violations = $this->validator->validate($data, groups: ['deleteValidation']]);
if(0 !== \count($violations)) {
//trigger some error / throw some exception...for example :
throw new ValidationException($violations);
}
$this->doctrineProcessor->process($data, $operation, $uriVariables, $context);
}
Expand Down

0 comments on commit 3583931

Please sign in to comment.