You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ErrorsAwareInterface is a marker same as PostValidationHookInterface.
It may set all errors after validation into an validated object. It may unify forms and request-model.
interfaceErrorsAwareInterface {
publicfunctionaddError(string$attribute): void;
publicfunctiongetError(string$attribute): mixed; <-- either Stringable or Stringable[]
publicfunctionhasError(string$attribute): bool;
publicfunctionsetErrors(array$errorsMap): void;
publicfunctiongetErrors(): array;
publicfunctionhasErrors(): bool;
}
So the base trait should implement all of these methods;
Usage is simple:
$validator->validate($object);
if ($object->hasErrors()) {
// ...
}
Instead of
$result = $validator->validate($object);
if ($result->hasErrors()) {
// ...
}
It may be useful with nested structures that may be hard accessible and just a shortcut to pass both errors and the object somewhere together.
The text was updated successfully, but these errors were encountered:
ErrorsAwareInterface
is a marker same as PostValidationHookInterface.It may set all errors after validation into an validated object. It may unify
forms
andrequest-model
.So the base trait should implement all of these methods;
Usage is simple:
Instead of
It may be useful with nested structures that may be hard accessible and just a shortcut to pass both errors and the object somewhere together.
The text was updated successfully, but these errors were encountered: