Skip to content
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

Merged
merged 1 commit into from
Apr 10, 2017

Conversation

hhamon
Copy link
Contributor

@hhamon hhamon commented Apr 10, 2017

No description provided.

@hhamon hhamon self-assigned this Apr 10, 2017
@hhamon hhamon force-pushed the bugfix-procuration-uniqueness branch 2 times, most recently from fdd5139 to 9cb873b Compare April 10, 2017 13:10
@hhamon hhamon force-pushed the bugfix-procuration-uniqueness branch 2 times, most recently from d5a4f01 to 7f45580 Compare April 10, 2017 13:21
@@ -101,13 +101,20 @@
{{ form_errors(form.emailAddress) }}
</div>

{{ form_rest(form) }}
{% for warning in form.vars['warnings'] %}
Copy link
Contributor

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)
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

: void

@hhamon hhamon force-pushed the bugfix-procuration-uniqueness branch from 7f45580 to 5813ea1 Compare April 10, 2017 13:29
… already existing procuration requests in the database with the same email address.
@hhamon hhamon force-pushed the bugfix-procuration-uniqueness branch from 5813ea1 to 0dc9629 Compare April 10, 2017 13:33
@hhamon hhamon merged commit ec87a3b into master Apr 10, 2017
@hhamon hhamon deleted the bugfix-procuration-uniqueness branch April 10, 2017 13:38
{
$request = $event->getData();
if (!is_array($request)) {
throw new UnexpectedTypeException($request, 'array');
Copy link
Contributor

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.');
Copy link
Contributor

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
Copy link
Contributor

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']) {
Copy link
Contributor

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants