ikucheriavenko
7/27/2017 - 3:17 AM

Add validation errors manually to form was hard to add this during form event catching

Add validation errors manually to form was hard to add this during form event catching

$errors = $this->validator->validate($notificationRequest);

        if (count($errors) > 0) {
            foreach ($errors as $error) {
                $form
                    ->get($error->getPropertyPath())
                    ->addError(
                        new FormError($error->getMessage(), null, [])
                    );
            }

            return;
        }