You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- <?php
-
- namespace Lc\ShopBundle\Controller\Admin;
-
- use Lc\ShopBundle\Context\MerchantInterface;
- use Symfony\Component\HttpFoundation\RedirectResponse;
- use Symfony\Component\HttpFoundation\Request;
-
- class MerchantController extends AdminController
- {
-
- public function switchMerchantAction(Request $request): RedirectResponse
- {
- $em = $this->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') ;
- }
-
- }
|