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

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. /**
  3.  * @copyright  Copyright (c) 2020, Net Inventors GmbH
  4.  * @category   Shopware
  5.  * @author     drebrov
  6.  */
  7. namespace NetInventors\NetiNextAccessManager;
  8. use Doctrine\DBAL\DBALException;
  9. use Exception;
  10. use Shopware\Core\Framework\Plugin;
  11. use Shopware\Core\Framework\Plugin\Context\InstallContext;
  12. use Shopware\Core\Framework\Plugin\Context\UninstallContext;
  13. use NetInventors\NetiNextAccessManager\Components\Setup;
  14. use Shopware\Core\Framework\Plugin\Context\UpdateContext;
  15. use Symfony\Component\DependencyInjection\ContainerInterface;
  16. /**
  17.  * Class NetiNextAccessManager
  18.  *
  19.  * @package NetInventors\NetiNextAccessManager
  20.  */
  21. class NetiNextAccessManager extends Plugin
  22. {
  23.     /**
  24.      * @param InstallContext $installContext
  25.      *
  26.      * @throws Exception
  27.      */
  28.     public function install(InstallContext $installContext): void
  29.     {
  30.         parent::install($installContext);
  31.         if (!$this->container instanceof ContainerInterface) {
  32.             return;
  33.         }
  34.         (new Setup($installContext$this->container))->install();
  35.     }
  36.     /**
  37.      * @throws Exception
  38.      */
  39.     public function update(UpdateContext $updateContext): void
  40.     {
  41.         parent::update($updateContext);
  42.         if (!$this->container instanceof ContainerInterface) {
  43.             return;
  44.         }
  45.         (new Setup($updateContext$this->container))->update();
  46.     }
  47.     /**
  48.      * @throws DBALException
  49.      * @throws Exception
  50.      */
  51.     public function uninstall(UninstallContext $uninstallContext): void
  52.     {
  53.         parent::uninstall($uninstallContext);
  54.         if (!$this->container instanceof ContainerInterface)  {
  55.             return;
  56.         }
  57.         if ($uninstallContext->keepUserData()) {
  58.             return;
  59.         }
  60.         (new Setup($uninstallContext$this->container))->uninstall();
  61.     }
  62. }