custom/plugins/EasyCreditRatenkauf/src/Payment/StorageInitializer.php line 33

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4.  * (c) NETZKOLLEKTIV GmbH <kontakt@netzkollektiv.com>
  5.  * For the full copyright and license information, please view the LICENSE
  6.  * file that was distributed with this source code.
  7.  */
  8. namespace Netzkollektiv\EasyCredit\Payment;
  9. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  10. use Shopware\Core\System\SalesChannel\Event\SalesChannelContextCreatedEvent;
  11. use Netzkollektiv\EasyCredit\Api\Storage;
  12. class StorageInitializer implements EventSubscriberInterface
  13. {
  14.     private Storage $storage;
  15.     public function __construct(
  16.         Storage $storage
  17.     ) {
  18.         $this->storage $storage;
  19.     }
  20.     public static function getSubscribedEvents()
  21.     {
  22.         return [
  23.             SalesChannelContextCreatedEvent::class => 'onContextCreate'
  24.         ];
  25.     }
  26.     public function onContextCreate(SalesChannelContextCreatedEvent $event): void
  27.     {
  28.         $context $event->getSalesChannelContext();
  29.         $this->storage->initialize($context);
  30.     }
  31. }