[CORE][Form] Remove unweildy return of form errors from Form::handle

This commit is contained in:
Hugo Sales 2022-03-13 14:19:56 +00:00
parent 8433771465
commit 5c708af272
No known key found for this signature in database
GPG Key ID: 7D0C7EAFC9D835A0

View File

@ -163,15 +163,7 @@ abstract class Form
$form->handleRequest($request); $form->handleRequest($request);
if ($request->getMethod() === 'POST' && $form->isSubmitted()) { if ($request->getMethod() === 'POST' && $form->isSubmitted()) {
if (!$form->isValid()) { if ($form->isValid()) {
$errors = [];
foreach ($form->all() as $child) {
if (!$child->isValid()) {
$errors[$child->getName()] = (string) $form[$child->getName()]->getErrors();
}
}
return $errors;
} else {
$data = $form->getData(); $data = $form->getData();
if (\is_null($target)) { if (\is_null($target)) {
return $data; return $data;