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 Lc\ShopBundle\Context\FilterMerchantInterface;
  4. use Lc\ShopBundle\Context\FilterMultipleMerchantsInterface;
  5. use Lc\ShopBundle\Context\MerchantUtilsInterface;
  6. use Lc\ShopBundle\Context\SortableInterface;
  7. use Lc\ShopBundle\Context\StatusInterface;
  8. use Lc\ShopBundle\Context\TreeInterface;
  9. use Lc\ShopBundle\Services\Utils;
  10. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  11. use Symfony\Component\EventDispatcher\GenericEvent;
  12. class InitializeEventSubscriber implements EventSubscriberInterface
  13. {
  14. public $merchantUtils;
  15. public $utils;
  16. public function __construct(MerchantUtilsInterface $merchantUtils, Utils $utils)
  17. {
  18. $this->merchantUtils = $merchantUtils;
  19. $this->utils = $utils;
  20. }
  21. public static function getSubscribedEvents()
  22. {
  23. return array(
  24. 'easy_admin.post_initialize' => array('initialize'),
  25. 'easy_admin.post_update' => array('updateCommonProperty'),
  26. );
  27. }
  28. public function initialize(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. }