|
12345678910111213141516171819202122232425262728293031323334 |
- <?php
-
- namespace Lc\CaracoleBundle\Controller\Merchant;
-
- use Lc\CaracoleBundle\Form\Merchant\SwitchMerchantFormType;
- use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
- use Symfony\Component\HttpFoundation\Request;
-
- class SwitchMerchantController extends AbstractController
- {
-
- public function switchMerchant(Request $request)
- {
- $form = $this->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->getMerchantConfig('url');
-
- if($context == 'admin') {
- $url .= 'admin' ;
- }
-
- if ($url) {
- return $this->redirect($url);
- }
- }
- }
- }
- }
|