custom/plugins/ShopWithMeDeal/src/ShopWithMeDeal.php line 15

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