custom/plugins/LyranetworkLyra/src/LyranetworkLyra.php line 34

Open in your IDE?
  1. <?php
  2. /**
  3.  * Copyright © Lyra Network.
  4.  * This file is part of Lyra Collect for Shopware. See COPYING.md for license details.
  5.  *
  6.  * @author    Lyra Network <https://www.lyra.com>
  7.  * @copyright Lyra Network
  8.  * @license   https://opensource.org/licenses/mit-license.html The MIT License (MIT)
  9.  */
  10. declare(strict_types=1);
  11. namespace Lyranetwork\Lyra;
  12. use Lyranetwork\Lyra\Installer\ConfigInstaller;
  13. use Lyranetwork\Lyra\Installer\CustomFieldInstaller;
  14. use Lyranetwork\Lyra\Installer\PaymentMethodInstaller;
  15. use Shopware\Core\System\SystemConfig\SystemConfigService;
  16. use Shopware\Core\Framework\Plugin;
  17. use Shopware\Core\Framework\Context;
  18. use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface;
  19. use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
  20. use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter;
  21. use Shopware\Core\Framework\Plugin\Context\ActivateContext;
  22. use Shopware\Core\Framework\Plugin\Context\DeactivateContext;
  23. use Shopware\Core\Framework\Plugin\Context\InstallContext;
  24. use Shopware\Core\Framework\Plugin\Context\UninstallContext;
  25. use Shopware\Core\Framework\Plugin\Util\PluginIdProvider;
  26. use Symfony\Component\Config\FileLocator;
  27. use Symfony\Component\DependencyInjection\ContainerBuilder;
  28. use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
  29. class LyranetworkLyra extends Plugin
  30. {
  31.     public function install(InstallContext $context): void
  32.     {
  33.         (new ConfigInstaller($this->container$context->getContext()))->install($context);
  34.         (new PaymentMethodInstaller($this->container))->install($context);
  35.         (new CustomFieldInstaller($this->container))->install($context);
  36.     }
  37.     public function uninstall(UninstallContext $context): void
  38.     {
  39.         // Only set the payment method as inactive when uninstalling. Removing the payment method would
  40.         // cause data consistency issues, since the payment method might have been used in several orders.
  41.         (new PaymentMethodInstaller($this->container))->uninstall($context);
  42.     }
  43.     public function activate(ActivateContext $context): void
  44.     {
  45.         (new PaymentMethodInstaller($this->container))->activate($context);
  46.         (new CustomFieldInstaller($this->container))->activate($context);
  47.         parent::activate($context);
  48.     }
  49.     public function deactivate(DeactivateContext $context): void
  50.     {
  51.         (new PaymentMethodInstaller($this->container))->deactivate($context);
  52.         (new CustomFieldInstaller($this->container))->deactivate($context);
  53.         parent::deactivate($context);
  54.     }
  55. }