Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Foo
- {
- public function detailsAction(Request $request, $quoteId)
- {
- $service = $this->get('surely_platform_api.platform_api_service');
- $form = $this->createForm(new PersonalDetailsType());
- if ($form->handleRequest($request) && $form->isValid()) {
- $formData = $form->getData();
- $emailAddress = $formData['email'];
- $personalId = $formData['person_id'];
- $phoneNumber = $formData['mobile'];
- $apiResult = $service->createPolicyForQuote($quoteId, $emailAddress, $personalId, $phoneNumber);
- if (false == $apiResult->hasErrors) {
- return $this->redirect($this->generateUrl('dental_agree', array(
- 'policyId' => $apiResult->result,
- )));
- }
- // Do something
- foreach ($apiResult->errors as $error) {
- $form->addError(new FormError($error->Message));
- }
- }
- return array(
- 'form' => $form->createView(),
- 'quote' => $service->getQuoteDetails($quoteId),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement