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