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