platform/src/Core/Framework/Event/EventAction/EventActionSubscriber.php line 33

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Framework\Event\EventAction;
  3. use Doctrine\DBAL\Connection;
  4. use Shopware\Core\Content\MailTemplate\MailTemplateEvents;
  5. use Shopware\Core\Framework\DataAbstractionLayer\Event\EntityDeletedEvent;
  6. use Shopware\Core\Framework\Feature;
  7. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  8. /**
  9.  * @deprecated tag:v6.5.0 - Will be removed in v6.5.0.
  10.  */
  11. class EventActionSubscriber implements EventSubscriberInterface
  12. {
  13.     /**
  14.      * @var Connection
  15.      */
  16.     private $connection;
  17.     public function __construct(Connection $connection)
  18.     {
  19.         $this->connection $connection;
  20.     }
  21.     public static function getSubscribedEvents()
  22.     {
  23.         return [
  24.             MailTemplateEvents::MAIL_TEMPLATE_DELETED_EVENT => 'deleted',
  25.         ];
  26.     }
  27.     public function deleted(EntityDeletedEvent $event): void
  28.     {
  29.         Feature::triggerDeprecated('FEATURE_NEXT_17858''v6.4.6''v6.5.0''Will be removed in v6.5.0.');
  30.         if (Feature::isActive('FEATURE_NEXT_17858')) {
  31.             return;
  32.         }
  33.         $ids $event->getIds();
  34.         if (empty($ids)) {
  35.             return;
  36.         }
  37.         $this->connection->executeUpdate(
  38.             'DELETE FROM event_action
  39.              WHERE action_name = :action
  40.              AND JSON_UNQUOTE(JSON_EXTRACT(event_action.config, "$.mail_template_id")) IN (:ids)',
  41.             ['action' => 'action.mail.send''ids' => $ids],
  42.             ['ids' => Connection::PARAM_STR_ARRAY]
  43.         );
  44.     }
  45. }