public function postAction(Request $request) { $form = new ConfigurationForm($request); try { $configForm = $this->validateForm($form); $data = $configForm->getData(); $paylineConfig = new PaylineConfig(); $paylineConfig->merge($data); // Redirect to the success URL, if ($this->getRequest()->get('save_mode') == 'stay') { // If we have to stay on the same page, redisplay the configuration page/ $route = '/admin/module/Payline'; } else { // If we have to close the page, go back to the module back-office page. $route = '/admin/modules'; } return RedirectResponse::create(URL::getInstance()->absoluteUrl($route)); } catch (FormValidationException $e) { $error = $this->createStandardFormValidationErrorMessage($e); } catch (\Exception $e) { $error = $e->getMessage(); } $this->setupFormErrorContext('Payline Configuration', $error, $form, $e); return $this->render('module-configure', ['module_code' => 'Payline']); }