Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

49 lines
1.5KB

  1. <?php
  2. namespace Lc\ShopBundle\EventSubscriber;
  3. use EasyCorp\Bundle\EasyAdminBundle\Event\EasyAdminEvents;
  4. use Lc\ShopBundle\Context\FilterMerchantInterface;
  5. use Lc\ShopBundle\Context\FilterMultipleMerchantsInterface;
  6. use Lc\ShopBundle\Context\MerchantUtilsInterface;
  7. use Lc\ShopBundle\Context\SortableInterface;
  8. use Lc\ShopBundle\Context\StatusInterface;
  9. use Lc\ShopBundle\Context\TreeInterface;
  10. use Lc\ShopBundle\Services\Utils;
  11. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  12. use Symfony\Component\EventDispatcher\GenericEvent;
  13. class InitializeEventSubscriber implements EventSubscriberInterface
  14. {
  15. public $merchantUtils;
  16. public $utils;
  17. public function __construct(MerchantUtilsInterface $merchantUtils, Utils $utils)
  18. {
  19. $this->merchantUtils = $merchantUtils;
  20. $this->utils = $utils;
  21. }
  22. public static function getSubscribedEvents()
  23. {
  24. return array(
  25. 'easy_admin.post_initialize' => array('postInitialize'),
  26. );
  27. }
  28. public function postInitialize(GenericEvent $event)
  29. {
  30. dump($event);
  31. $request = $event->getArgument('request');
  32. if($request->query->get('hubredirection')){
  33. $this->utils->addFlash('alert', "Vous êtes maintenant sur le hub de ".$this->merchantUtils->getMerchantCurrent()->getTitle());
  34. }
  35. }
  36. }