Skip to content

Commit 5ba7c7c

Browse files
committed
fix: small error in delete validation
The code in current version doesn't work and does nothing with the validation results.
1 parent 7e03e77 commit 5ba7c7c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

core/validation.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,11 @@ final readonly class MyEntityRemoveProcessor implements ProcessorInterface
419419

420420
public function process(mixed $data, Operation $operation, array $uriVariables = [], array $context = [])
421421
{
422-
$this->validator->validate($data, ['groups' => ['deleteValidation']]);
422+
$validationErrors = $this->validator->validate($data, groups: ['deleteValidation']]);
423+
if($validationErrors->count() > 0) {
424+
//trigger some error / throw some exception...for example
425+
throw new ConflictHttpException($errors->get(0)->getMessage());
426+
}
423427
$this->doctrineProcessor->process($data, $operation, $uriVariables, $context);
424428
}
425429
}

0 commit comments

Comments
 (0)