createForm(SwitchMerchantFormType::class); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $merchant = $form->get('merchant')->getData(); $context = $form->get('context')->getData(); if ($merchant) { $url = $this->getSettingValue( $merchant, MerchantSettingDefinition::SETTING_URL ); if ($context == 'admin') { $url .= 'admin'; } if ($url) { return $this->redirect($url); } } } } }