您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

SwitchMerchantController.php 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace Lc\CaracoleBundle\Controller\Merchant;
  3. use Lc\CaracoleBundle\Definition\MerchantSettingDefinition;
  4. use Lc\CaracoleBundle\Form\Merchant\SwitchMerchantFormType;
  5. use Lc\CaracoleBundle\Repository\Merchant\MerchantRepository;
  6. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  7. use Symfony\Component\HttpFoundation\Request;
  8. class SwitchMerchantController extends AbstractController
  9. {
  10. public function switchMerchant(Request $request, MerchantRepository $merchantRepository)
  11. {
  12. $form = $this->createForm(SwitchMerchantFormType::class);
  13. $form->handleRequest($request);
  14. if ($form->isSubmitted() && $form->isValid()) {
  15. $merchant = $form->get('merchant')->getData();
  16. $context = $form->get('context')->getData();
  17. if ($merchant) {
  18. $url = $merchant->getSettingValue(MerchantSettingDefinition::SETTING_URL);
  19. if ($context == 'admin') {
  20. $url .= 'admin';
  21. }
  22. if ($url) {
  23. return $this->redirect($url);
  24. }
  25. }
  26. }
  27. }
  28. public function visitMerchant()
  29. {
  30. }
  31. }