-
-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added confirmation step with warning message if there are already existing procuration requests in the database with the same email address. #854
Conversation
fdd5139
to
9cb873b
Compare
d5a4f01
to
7f45580
Compare
@@ -101,13 +101,20 @@ | |||
{{ form_errors(form.emailAddress) }} | |||
</div> | |||
|
|||
{{ form_rest(form) }} | |||
{% for warning in form.vars['warnings'] %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about form.vars.warnings
?
{ | ||
$this->repository = $repository; | ||
} | ||
|
||
public function buildForm(FormBuilderInterface $builder, array $options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
: void
return; | ||
} | ||
|
||
// In case of on or more existing procurations with the same email |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/on/one/
return; | ||
} | ||
|
||
// In case of on or more existing procurations with the same email |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/on/one/
return; | ||
} | ||
|
||
// In case, this is a new procuration request, we must determine whether |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case of a new procuration request ?
} | ||
} | ||
|
||
public function buildView(FormView $view, FormInterface $form, array $options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
: void
} | ||
} | ||
|
||
$view->vars['errors'] = new FormErrorIterator($form, $errors); | ||
} | ||
|
||
public function configureOptions(OptionsResolver $resolver) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
: void
7f45580
to
5813ea1
Compare
… already existing procuration requests in the database with the same email address.
5813ea1
to
0dc9629
Compare
{ | ||
$request = $event->getData(); | ||
if (!is_array($request)) { | ||
throw new UnexpectedTypeException($request, 'array'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use a TranformationFailedException
in submit related events so the client gets an error and not a 500.
} | ||
|
||
if (!in_array($request['state'], ['new_request', 'must_confirm', 'confirmed'])) { | ||
throw new RuntimeException('Invalid value for the "state" field.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
$builder->addEventListener(FormEvents::PRE_SUBMIT, [$this, 'onPreSubmit']); | ||
} | ||
|
||
public function onPreSubmit(FormEvent $event): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be public.
// In case of a new procuration request, we must determine whether or | ||
// not there are already existing procuration requests with the same | ||
// email address. If yes, the user will have to confirm his choice. | ||
if ('new_request' === $request['state']) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't you use constants?
|
||
public function buildView(FormView $view, FormInterface $form, array $options): void | ||
{ | ||
parent::buildView($view, $form, $options); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's that?
No description provided.