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

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