getDoctrine()->getManager(); $idMerchant = $request->request->get('id_merchant') ; $merchant = $this->getDoctrine() ->getRepository(MerchantInterface::class) ->find($idMerchant); if($merchant) { $user = $this->security->getUser() ; $user->setMerchant($merchant) ; $em->persist($user); $em->flush() ; } return $this->redirect('admin/dashboard') ; } }