custom/plugins/NetiNextEasyCouponGenerator/src/NetiNextEasyCouponGenerator.php line 14

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace NetInventors\NetiNextEasyCouponGenerator;
  4. use Doctrine\DBAL\DBALException;
  5. use Shopware\Core\Framework\Plugin;
  6. use NetInventors\NetiNextEasyCouponGenerator\Components\Setup;
  7. use Shopware\Core\Framework\Plugin\Context\InstallContext;
  8. use Shopware\Core\Framework\Plugin\Context\UninstallContext;
  9. /** @psalm-suppress PropertyNotSetInConstructor */
  10. class NetiNextEasyCouponGenerator extends Plugin
  11. {
  12.     /**
  13.      * @param InstallContext $installContext
  14.      *
  15.      * @throws \Throwable
  16.      */
  17.     public function install(InstallContext $installContext): void
  18.     {
  19.         parent::install($installContext);
  20.         if (isset($this->container)) {
  21.             (new Setup($installContext$this->container))->install();
  22.         }
  23.     }
  24.     /**
  25.      * @param UninstallContext $uninstallContext
  26.      *
  27.      * @throws DBALException
  28.      */
  29.     public function uninstall(UninstallContext $uninstallContext): void
  30.     {
  31.         parent::uninstall($uninstallContext);
  32.         if ($uninstallContext->keepUserData()) {
  33.             return;
  34.         }
  35.         if (isset($this->container)) {
  36.             (new Setup($uninstallContext$this->container))->uninstall();
  37.         }
  38.     }
  39. }