vendor/store.shopware.com/mltisafemultisafepay/src/MltisafeMultiSafepay.php line 21

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. /**
  3.  * Copyright © MultiSafepay, Inc. All rights reserved.
  4.  * See DISCLAIMER.md for disclaimer details.
  5.  */
  6. namespace MultiSafepay\Shopware6;
  7. use MultiSafepay\Shopware6\Installers\MediaInstaller;
  8. use MultiSafepay\Shopware6\Installers\PaymentMethodsInstaller;
  9. use Shopware\Core\Framework\Plugin;
  10. use Shopware\Core\Framework\Plugin\Context\ActivateContext;
  11. use Shopware\Core\Framework\Plugin\Context\DeactivateContext;
  12. use Shopware\Core\Framework\Plugin\Context\InstallContext;
  13. use Shopware\Core\Framework\Plugin\Context\UninstallContext;
  14. use Shopware\Core\Framework\Plugin\Context\UpdateContext;
  15. use Symfony\Component\Config\FileLocator;
  16. use Symfony\Component\DependencyInjection\ContainerBuilder;
  17. use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
  18. class MltisafeMultiSafepay extends Plugin
  19. {
  20.     /**
  21.      * @param ContainerBuilder $container
  22.      */
  23.     public function build(ContainerBuilder $container): void
  24.     {
  25.         parent::build($container);
  26.         $loader = new XmlFileLoader($container, new FileLocator(__DIR__ '/Resources/config'));
  27.         $loader->load('services.xml');
  28.     }
  29.     /**
  30.      * @param InstallContext $installContext
  31.      */
  32.     public function install(InstallContext $installContext): void
  33.     {
  34.         (new MediaInstaller($this->container))->install($installContext);
  35.         (new PaymentMethodsInstaller($this->container))->install($installContext);
  36.         parent::install($installContext);
  37.     }
  38.     /**
  39.      * @param UpdateContext $updateContext
  40.      */
  41.     public function update(UpdateContext $updateContext): void
  42.     {
  43.         (new MediaInstaller($this->container))->update($updateContext);
  44.         (new PaymentMethodsInstaller($this->container))->update($updateContext);
  45.         parent::update($updateContext);
  46.     }
  47.     /**
  48.      * @param ActivateContext $activateContext
  49.      */
  50.     public function activate(ActivateContext $activateContext): void
  51.     {
  52.         (new PaymentMethodsInstaller($this->container))->activate($activateContext);
  53.         parent::activate($activateContext);
  54.     }
  55.     /**
  56.      * @param DeactivateContext $deactivateContext
  57.      */
  58.     public function deactivate(DeactivateContext $deactivateContext): void
  59.     {
  60.         (new PaymentMethodsInstaller($this->container))->deactivate($deactivateContext);
  61.         parent::deactivate($deactivateContext);
  62.     }
  63.     /**
  64.      * @param UninstallContext $uninstallContext
  65.      */
  66.     public function uninstall(UninstallContext $uninstallContext): void
  67.     {
  68.         (new MediaInstaller($this->container))->uninstall($uninstallContext);
  69.         (new PaymentMethodsInstaller($this->container))->uninstall($uninstallContext);
  70.         parent::uninstall($uninstallContext);
  71.     }
  72. }