Du kan inte välja fler än 25 ämnen
Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
|
- <?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()
- {
-
- }
- }
|