Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

InitializeEventSubscriber.php 1.4KB

pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
pirms 4 gadiem
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. }