custom/plugins/AkuCmsFactory/src/AkuCmsFactory.php line 9

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace AkuCmsFactory;
  3. use Shopware\Core\Framework\Plugin\Context\UninstallContext;
  4. use Shopware\Core\Framework\Plugin;
  5. use Doctrine\DBAL\Connection;
  6. class AkuCmsFactory extends Plugin
  7. {
  8.     /**
  9.      * @inheritDoc
  10.      */
  11.     public function uninstall(UninstallContext $context): void
  12.     {
  13.         if ($context->keepUserData()) {
  14.             parent::uninstall($context);
  15.             return;
  16.         }
  17.         
  18.         // Remove all data
  19.         $connection $this->container->get(Connection::class);
  20.         $connection->executeUpdate("DROP TABLE IF EXISTS `cms_factory_element`");
  21.         $productRepository $this->container->get('product.repository');
  22.         $connection->executeUpdate("DELETE FROM cms_slot WHERE `type`='aku-cms-factory'");
  23.         $connection->executeUpdate("DELETE FROM cms_block where `type`='aku-cms-factory'");
  24.         parent::uninstall($context);
  25.         
  26.         return;
  27.     }
  28. }