vendor/store.shopware.com/acrispromotioncs/src/AcrisPromotionCS.php line 9

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Acris\Promotion;
  3. use Doctrine\DBAL\Connection;
  4. use Shopware\Core\Framework\Plugin;
  5. use Shopware\Core\Framework\Plugin\Context\UninstallContext;
  6. class AcrisPromotionCS extends Plugin
  7. {
  8.     public function uninstall(UninstallContext $context): void
  9.     {
  10.         if ($context->keepUserData()) {
  11.             return;
  12.         }
  13.         $this->cleanupDatabase();
  14.     }
  15.     private function cleanupDatabase(): void
  16.     {
  17.         $connection $this->container->get(Connection::class);
  18.         $connection->executeStatement('DROP TABLE IF EXISTS acris_promotion_display');
  19.         $this->removeInheritance($connection'promotion''acrisPromotionDisplay');
  20.     }
  21.     protected function removeInheritance(Connection $connectionstring $entitystring $propertyName): void
  22.     {
  23.         $sql str_replace(
  24.             ['#table#''#column#'],
  25.             [$entity$propertyName],
  26.             'ALTER TABLE `#table#` DROP COLUMN `#column#`'
  27.         );
  28.         $connection->executeStatement($sql);
  29.     }
  30. }