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.

48 lines
1.4KB

  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. $request = $event->getArgument('request');
  31. if($request->query->get('hubredirection')){
  32. $this->utils->addFlash('alert', "Vous êtes maintenant sur le hub de ".$this->merchantUtils->getMerchantCurrent()->getTitle());
  33. }
  34. }
  35. }