vendor/shopware/core/Framework/Event/FlowEvent.php line 34

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Framework\Event;
  3. use Shopware\Core\Content\Flow\Dispatching\FlowState;
  4. use Shopware\Core\Framework\Context;
  5. use Shopware\Core\Framework\Event\EventData\EventDataCollection;
  6. use Shopware\Core\Framework\Feature;
  7. use Shopware\Core\Framework\Log\Package;
  8. use Symfony\Contracts\EventDispatcher\Event;
  9. /**
  10.  * @deprecated tag:v6.5.0 - Will be removed, use `FlowAction::handleFlow()` instead
  11.  */
  12. #[Package('business-ops')]
  13. class FlowEvent extends Event
  14. {
  15.     private FlowState $state;
  16.     /**
  17.      * @var array<string, mixed>
  18.      */
  19.     private $config;
  20.     private string $actionName;
  21.     /**
  22.      * @param array<string, mixed>|null $config
  23.      */
  24.     public function __construct(string $actionNameFlowState $state, ?array $config = [])
  25.     {
  26.         Feature::triggerDeprecationOrThrow(
  27.             'v6.5.0.0',
  28.             Feature::deprecatedClassMessage(__CLASS__'v6.5.0.0')
  29.         );
  30.         $this->actionName $actionName;
  31.         $this->state $state;
  32.         $this->config $config ?? [];
  33.     }
  34.     public function getEvent(): FlowEventAware
  35.     {
  36.         Feature::triggerDeprecationOrThrow(
  37.             'v6.5.0.0',
  38.             Feature::deprecatedClassMessage(__CLASS__'v6.5.0.0')
  39.         );
  40.         return $this->state->event;
  41.     }
  42.     /**
  43.      * @return array<string, mixed>
  44.      */
  45.     public function getConfig(): array
  46.     {
  47.         Feature::triggerDeprecationOrThrow(
  48.             'v6.5.0.0',
  49.             Feature::deprecatedClassMessage(__CLASS__'v6.5.0.0')
  50.         );
  51.         return $this->config;
  52.     }
  53.     public function getActionName(): string
  54.     {
  55.         Feature::triggerDeprecationOrThrow(
  56.             'v6.5.0.0',
  57.             Feature::deprecatedClassMessage(__CLASS__'v6.5.0.0')
  58.         );
  59.         return $this->actionName;
  60.     }
  61.     public static function getAvailableData(): EventDataCollection
  62.     {
  63.         Feature::triggerDeprecationOrThrow(
  64.             'v6.5.0.0',
  65.             Feature::deprecatedClassMessage(__CLASS__'v6.5.0.0')
  66.         );
  67.         return new EventDataCollection();
  68.     }
  69.     public function getName(): string
  70.     {
  71.         Feature::triggerDeprecationOrThrow(
  72.             'v6.5.0.0',
  73.             Feature::deprecatedClassMessage(__CLASS__'v6.5.0.0')
  74.         );
  75.         return $this->state->event->getName();
  76.     }
  77.     public function getContext(): Context
  78.     {
  79.         Feature::triggerDeprecationOrThrow(
  80.             'v6.5.0.0',
  81.             Feature::deprecatedClassMessage(__CLASS__'v6.5.0.0')
  82.         );
  83.         return $this->state->event->getContext();
  84.     }
  85.     public function getFlowState(): FlowState
  86.     {
  87.         Feature::triggerDeprecationOrThrow(
  88.             'v6.5.0.0',
  89.             Feature::deprecatedClassMessage(__CLASS__'v6.5.0.0')
  90.         );
  91.         return $this->state;
  92.     }
  93.     public function stop(): void
  94.     {
  95.         Feature::triggerDeprecationOrThrow(
  96.             'v6.5.0.0',
  97.             Feature::deprecatedClassMessage(__CLASS__'v6.5.0.0')
  98.         );
  99.         $this->state->stop true;
  100.     }
  101. }