src/Core/Framework/App/FlowAction/AppFlowActionLoadedSubscriber.php line 23

  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Framework\App\FlowAction;
  3. use Shopware\Core\Framework\App\Aggregate\FlowAction\AppFlowActionEntity;
  4. use Shopware\Core\Framework\DataAbstractionLayer\Event\EntityLoadedEvent;
  5. use Shopware\Core\Framework\Log\Package;
  6. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  7. /**
  8.  * @internal
  9.  */
  10. #[Package('core')]
  11. class AppFlowActionLoadedSubscriber implements EventSubscriberInterface
  12. {
  13.     public static function getSubscribedEvents(): array
  14.     {
  15.         return [
  16.             'app_flow_action.loaded' => 'unserialize',
  17.         ];
  18.     }
  19.     public function unserialize(EntityLoadedEvent $event): void
  20.     {
  21.         /** @var AppFlowActionEntity $appFlowAction */
  22.         foreach ($event->getEntities() as $appFlowAction) {
  23.             $iconRaw $appFlowAction->getIconRaw();
  24.             if ($iconRaw !== null) {
  25.                 $appFlowAction->setIcon(base64_encode($iconRaw));
  26.             }
  27.         }
  28.     }
  29. }