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

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Huebert\CustomDocuments;
  3. use Doctrine\DBAL\Connection;
  4. use Shopware\Core\Framework\Plugin;
  5. use Shopware\Core\Framework\Plugin\Context\UninstallContext;
  6. class HuebertCustomDocuments extends Plugin
  7. {
  8.     public function uninstallUninstallContext $uninstallContext ): void
  9.     {
  10.         $uninstallContext->setAutoMigratefalse ); // disable auto migration execution
  11.         $migrationCollection $uninstallContext->getMigrationCollection(); // get migration collection
  12.         if ( $uninstallContext->keepUserData() === false ) {
  13.             # @TODO fix destructive method todiscard foreign keys in first place
  14.             $migrationCollection->migrateDestructiveInPlace1641832837 ); // call AddHueCustomDocumentId
  15.             #$migrationCollection->migrateDestructiveInPlace( 1641832870 ); // call CustomDocumentTranslation
  16.             #$migrationCollection->migrateDestructiveInPlace( 1641832837 ); // call CustomDocument
  17.             /** @var Connection $connection */
  18.             $connection $this->container->get(Connection::class);
  19.             $connection->executeStatement('DROP TABLE IF EXISTS `hue_custom_document_translation`');
  20.             $connection->executeStatement('DROP TABLE IF EXISTS `hue_custom_document`');
  21.         }
  22.     }
  23. }