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

Open in your IDE?
  1. <?php
  2. namespace BAL\Plugin\ThreeDimensionModelView;
  3. use Doctrine\DBAL\Connection;
  4. use Shopware\Core\Framework\Plugin;
  5. use Shopware\Core\Framework\Plugin\Context\UninstallContext;
  6. class BALThreeDimensionModelView extends Plugin
  7. {
  8.     public function uninstall(UninstallContext $uninstallContext) : void
  9.     {
  10.         parent::uninstall($uninstallContext);
  11.         if ($uninstallContext->keepUserData()) {
  12.             return;
  13.         }
  14.         /** @var Connection $connection */
  15.         $connection $this->container->get(Connection::class);
  16.         /** @noinspection SqlNoDataSourceInspection */
  17.         $connection->executeStatement(
  18.             "
  19.             DROP TABLE IF EXISTS bal_three_dimension_model_category_extension;
  20.             DROP TABLE IF EXISTS bal_three_dimension_model_product;
  21.             DROP TABLE IF EXISTS bal_three_dimension_model;
  22.             ALTER TABLE product DROP COLUMN threeDimensionModels;
  23.             UPDATE media_folder as mf
  24.                 LEFT JOIN media_default_folder as mdf ON mf.default_folder_id = mdf.id
  25.                 SET mf.name = concat(name, ' (ARCHIVE)')
  26.                 WHERE mdf.entity = 'bal_three_dimension_model';
  27.             DELETE FROM media_default_folder WHERE `entity` = 'bal_three_dimension_model';
  28.             DELETE FROM system_config WHERE configuration_key LIKE 'BALThreeDimensionModelView.config.%';
  29.             "
  30.         );
  31.     }
  32. }