vendor/shopware/core/Content/Flow/Indexing/FlowIndexerSubscriber.php line 46

  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Content\Flow\Indexing;
  3. use Shopware\Core\Framework\App\Event\AppActivatedEvent;
  4. use Shopware\Core\Framework\App\Event\AppDeactivatedEvent;
  5. use Shopware\Core\Framework\App\Event\AppDeletedEvent;
  6. use Shopware\Core\Framework\App\Event\AppInstalledEvent;
  7. use Shopware\Core\Framework\App\Event\AppUpdatedEvent;
  8. use Shopware\Core\Framework\DataAbstractionLayer\Indexing\MessageQueue\IterateEntityIndexerMessage;
  9. use Shopware\Core\Framework\Log\Package;
  10. use Shopware\Core\Framework\Plugin\Event\PluginPostActivateEvent;
  11. use Shopware\Core\Framework\Plugin\Event\PluginPostDeactivateEvent;
  12. use Shopware\Core\Framework\Plugin\Event\PluginPostInstallEvent;
  13. use Shopware\Core\Framework\Plugin\Event\PluginPostUninstallEvent;
  14. use Shopware\Core\Framework\Plugin\Event\PluginPostUpdateEvent;
  15. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  16. use Symfony\Component\Messenger\MessageBusInterface;
  17. /**
  18.  * @internal
  19.  */
  20. #[Package('business-ops')]
  21. class FlowIndexerSubscriber implements EventSubscriberInterface
  22. {
  23.     public function __construct(private readonly MessageBusInterface $messageBus)
  24.     {
  25.     }
  26.     public static function getSubscribedEvents(): array
  27.     {
  28.         return [
  29.             PluginPostInstallEvent::class => 'refreshPlugin',
  30.             PluginPostActivateEvent::class => 'refreshPlugin',
  31.             PluginPostUpdateEvent::class => 'refreshPlugin',
  32.             PluginPostDeactivateEvent::class => 'refreshPlugin',
  33.             PluginPostUninstallEvent::class => 'refreshPlugin',
  34.             AppInstalledEvent::class => 'refreshPlugin',
  35.             AppUpdatedEvent::class => 'refreshPlugin',
  36.             AppActivatedEvent::class => 'refreshPlugin',
  37.             AppDeletedEvent::class => 'refreshPlugin',
  38.             AppDeactivatedEvent::class => 'refreshPlugin',
  39.         ];
  40.     }
  41.     public function refreshPlugin(): void
  42.     {
  43.         // Schedule indexer to update flows
  44.         $this->messageBus->dispatch(new IterateEntityIndexerMessage(FlowIndexer::NAMEnull));
  45.     }
  46. }