platform/src/Core/Framework/App/Subscriber/AppLoadedSubscriber.php line 21

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Framework\App\Subscriber;
  3. use Shopware\Core\Framework\App\AppEntity;
  4. use Shopware\Core\Framework\DataAbstractionLayer\Event\EntityLoadedEvent;
  5. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  6. /**
  7.  * @internal only for use by the app-system, will be considered internal from v6.4.0 onward
  8.  */
  9. class AppLoadedSubscriber implements EventSubscriberInterface
  10. {
  11.     public static function getSubscribedEvents(): array
  12.     {
  13.         return [
  14.             'app.loaded' => 'unserialize',
  15.         ];
  16.     }
  17.     public function unserialize(EntityLoadedEvent $event): void
  18.     {
  19.         /** @var AppEntity $app */
  20.         foreach ($event->getEntities() as $app) {
  21.             $iconRaw $app->getIconRaw();
  22.             if ($iconRaw !== null) {
  23.                 $app->setIcon(base64_encode($iconRaw));
  24.             }
  25.         }
  26.     }
  27. }