vendor/mrpix/shopping-city/src/MrpixShoppingCity.php line 13

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Mrpix\ShoppingCity;
  3. use Doctrine\DBAL\Connection;
  4. use Mrpix\ShoppingCity\Core\Content\SellerEvent\SellerEventDefinition;
  5. use Mrpix\ShoppingCity\Core\Content\SellerInformation\SellerInformationDefinition;
  6. use Mrpix\ShoppingCity\Core\Content\SellerNews\SellerNewsDefinition;
  7. use Mrpix\ShoppingCity\Core\Content\SellerProperty\SellerPropertyDefinition;
  8. use Shopware\Core\Framework\Plugin;
  9. use Shopware\Core\Framework\Plugin\Context\UninstallContext;
  10. class MrpixShoppingCity extends Plugin
  11. {
  12.     private const TABLE_NAMES = [
  13.         SellerEventDefinition::ENTITY_NAME,
  14.         SellerInformationDefinition::ENTITY_NAME,
  15.         SellerNewsDefinition::ENTITY_NAME,
  16.         SellerPropertyDefinition::ENTITY_NAME,
  17.     ];
  18.     public function uninstall(UninstallContext $uninstallContext): void
  19.     {
  20.         if ($uninstallContext->keepUserData()) {
  21.             return;
  22.         }
  23.         $this->removeTables();
  24.         parent::uninstall($uninstallContext);
  25.     }
  26.     private function removeTables(): void
  27.     {
  28.         /** @var Connection $connection */
  29.         $connection $this->container->get(Connection::class);
  30.         foreach (self::TABLE_NAMES as $table) {
  31.             $connection->executeStatement('DROP TABLE ' $table);
  32.         }
  33.     }
  34. }