custom/plugins/PayrexxPaymentGatewaySW6/src/PayrexxPaymentGatewaySW6.php line 24

  1. <?php
  2. declare(strict_types=1);
  3. namespace PayrexxPaymentGateway;
  4. use PayrexxPaymentGateway\Installer\PayrexxPaymentInstaller;
  5. use Shopware\Core\Framework\Plugin;
  6. use Shopware\Core\Framework\Context;
  7. use Shopware\Core\Framework\Uuid\Uuid;
  8. use Shopware\Core\Content\Media\MediaEntity;
  9. use Shopware\Core\Content\Media\File\FileSaver;
  10. use Shopware\Core\Content\Media\File\MediaFile;
  11. use Shopware\Core\Framework\Plugin\Context\InstallContext;
  12. use Shopware\Core\Framework\Plugin\Context\ActivateContext;
  13. use Shopware\Core\Framework\Plugin\Context\UninstallContext;
  14. use Shopware\Core\Framework\Plugin\Context\DeactivateContext;
  15. use Shopware\Core\Framework\Plugin\Context\UpdateContext;
  16. use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
  17. use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter;
  18. use Symfony\Component\Filesystem\Filesystem;
  19. use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
  20. class PayrexxPaymentGatewaySW6 extends Plugin
  21. {
  22.     /**
  23.      * @param InstallContext $context
  24.      */
  25.     public function install(InstallContext $context): void
  26.     {
  27.         (new PayrexxPaymentInstaller($this->container))->install($context);
  28.         parent::install($context);
  29.     }
  30.     /**
  31.      * @param UninstallContext $context
  32.      */
  33.     public function uninstall(UninstallContext $context): void
  34.     {
  35.         (new PayrexxPaymentInstaller($this->container))->uninstall($context);
  36.         parent::uninstall($context);
  37.     }
  38.     /**
  39.      * @param ActivateContefxt $context
  40.      */
  41.     public function activate(ActivateContext $context): void
  42.     {
  43.         (new PayrexxPaymentInstaller($this->container))->activate($context);
  44.         parent::activate($context);
  45.     }
  46.     /**
  47.      * @param DeactivateContext $context
  48.      */
  49.     public function deactivate(DeactivateContext $context): void
  50.     {
  51.         (new PayrexxPaymentInstaller($this->container))->deactivate($context);
  52.         parent::deactivate($context);
  53.     }
  54.     /**
  55.      * @param UpdateContext $context
  56.      */
  57.     public function update(UpdateContext $context): void
  58.     {
  59.         (new PayrexxPaymentInstaller($this->container))->update($context);
  60.         parent::update($context);
  61.     }
  62.     /**
  63.      * @param RoutingConfigurator $routes
  64.      * @param string $environment
  65.      * @return void
  66.      */
  67.     public function configureRoutes(RoutingConfigurator $routesstring $environment): void
  68.     {
  69.         if (!$this->isActive()) {
  70.             return;
  71.         }
  72.         /** @var string $version */
  73.         $version $this->container->getParameter('kernel.shopware_version');
  74.         $pos strpos($version'6.4');
  75.         $routeDir =  $this->getPath() . '/Resources/config/compatibility/routes/';
  76.         if ($pos !== false) {
  77.             $routeFile $routeDir 'routes_64.xml';
  78.         } else {
  79.             $routeFile $routeDir 'routes_6.xml';
  80.         }
  81.         $fileSystem = new Filesystem();
  82.         if ($fileSystem->exists($routeFile)) {
  83.             $routes->import($routeFile);
  84.         }
  85.     }
  86. }