custom/plugins/IfizzQuickVariants/src/IfizzQuickVariants.php line 14

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Ifizz\QuickVariants;
  3. use Exception;
  4. use Shopware\Core\Framework\Plugin;
  5. use Doctrine\DBAL\Connection;
  6. use Shopware\Core\Framework\Plugin\Context\UninstallContext;
  7. use SwagMigrationAssistant\SwagMigrationAssistant;
  8. use Symfony\Component\Config\FileLocator;
  9. use Symfony\Component\DependencyInjection\ContainerBuilder;
  10. use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
  11. class IfizzQuickVariants extends Plugin
  12. {
  13.     /**
  14.      * @param ContainerBuilder $container
  15.      *
  16.      * @throws Exception
  17.      */
  18.     public function build(ContainerBuilder $container): void
  19.     {
  20.         parent::build($container);
  21.         $activePlugins $container->getParameter('kernel.active_plugins');
  22.         if (isset($activePlugins[SwagMigrationAssistant::class])) {
  23.             // Only load migration relevant classes if the SwagMigrationAssistant is available
  24.             $loader = new XmlFileLoader($container, new FileLocator(__DIR__ '/DependencyInjection/'));
  25.             $loader->load('migration_assistant_extension.xml');
  26.         }
  27.     }
  28.     public function uninstall(UninstallContext $context): void
  29.     {
  30. //
  31. //        if ($context->keepUserData()) {
  32. //            parent::uninstall($context);
  33. //
  34. //            return;
  35. //        }
  36. //
  37. //        $connection = $this->container->get(Connection::class);
  38. //
  39. //        $connection->executeUpdate('DROP TABLE IF EXISTS `ifizz_property_group_option_color`');
  40. //        $connection->executeUpdate('ALTER TABLE `property_group_option` DROP COLUMN `variant_id`');
  41. //
  42. //        parent::uninstall($context);
  43.     }
  44. }