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\CaracoleBundle\Controller\Merchant;
-
- use Lc\CaracoleBundle\Definition\MerchantSettingDefinition;
- use Lc\CaracoleBundle\Form\Merchant\SwitchMerchantFormType;
- use Lc\CaracoleBundle\Repository\Merchant\MerchantRepository;
- use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
- use Symfony\Component\HttpFoundation\Request;
-
- class SwitchMerchantController extends AbstractController
- {
-
- public function switchMerchant(Request $request, MerchantRepository $merchantRepository)
- {
- $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->getSettingValue(MerchantSettingDefinition::SETTING_URL);
-
- if ($context == 'admin') {
- $url .= 'admin';
- }
-
- if ($url) {
- return $this->redirect($url);
- }
- }
- }
- }
-
- public function visitMerchant()
- {
-
- }
- }
|