custom/plugins/ShopWithMeAuthenticate/src/ShopWithMeAuthenticate.php line 13

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace ShopWithMe\Authenticate;
  3. use Doctrine\DBAL\Connection;
  4. use Shopware\Core\Framework\Plugin;
  5. use Shopware\Core\Framework\Plugin\Context\InstallContext;
  6. use Shopware\Core\Framework\Plugin\Context\UninstallContext;
  7. use Shopware\Core\Framework\Plugin\Context\UpdateContext;
  8. use ShopWithMe\Authenticate\Lifecycle\InstallerFactory;
  9. use ShopWithMe\Authenticate\Service\InstallerInterface;
  10. class ShopWithMeAuthenticate extends Plugin
  11. {
  12.     public function install(InstallContext $installContext): void
  13.     {
  14.         $this->getInstaller()->install($installContext);
  15.     }
  16.     public function update(UpdateContext $updateContext): void
  17.     {
  18.         $this->getInstaller()->update($updateContext);
  19.     }
  20.     protected function getInstaller(): InstallerInterface
  21.     {
  22.         $factory = new InstallerFactory($this->container);
  23.         return $factory->create();
  24.     }
  25.     /**
  26.      * @param UninstallContext $context
  27.      */
  28.     public function uninstall(UninstallContext $context): void
  29.     {
  30.         parent::uninstall($context);
  31.         if ($context->keepUserData()) {
  32.             return;
  33.         }
  34.         $connection $this->container->get(Connection::class);
  35.         $connection->executeStatement('DROP TABLE IF EXISTS `customer`');
  36.     }
  37. }