Skip to content

Commit 9776f6e

Browse files
authored
fix: small error in delete validation
The code in current version doesn't work and does nothing with the validation results.
1 parent 0f2f10c commit 9776f6e

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
@@ -421,7 +421,11 @@ class MyEntityRemoveProcessor implements ProcessorInterface
421421

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

0 commit comments

Comments
 (0)