src/Event/CampaignUpdateHistorySubscriber.php line 27

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Event;
  4. use App\Event\CampaignUpdateHistoryEvent;
  5. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  6. use App\Services\Campaign\CampaignUpdateHistoryService;
  7. class CampaignUpdateHistorySubscriber implements EventSubscriberInterface
  8. {
  9.     protected CampaignUpdateHistoryService $campaignUpdateHistoryService;
  10.     public function __construct(CampaignUpdateHistoryService $campaignUpdateHistoryService)
  11.     {
  12.         $this->campaignUpdateHistoryService $campaignUpdateHistoryService;
  13.     }
  14.     public static function getSubscribedEvents()
  15.     {
  16.         return [
  17.             CampaignUpdateHistoryEvent::NAME => 'onCampaignUpdate',
  18.         ];
  19.     }
  20.     public function onCampaignUpdate(CampaignUpdateHistoryEvent $event): void
  21.     {
  22.         $this->campaignUpdateHistoryService->saveCampaignUpdateHistory(
  23.             $event->getCampaign(),
  24.             $event->getUser()
  25.         );
  26.     }
  27. }