<?php declare(strict_types=1);
namespace Ifizz\QuickVariants;
use Exception;
use Shopware\Core\Framework\Plugin;
use Doctrine\DBAL\Connection;
use Shopware\Core\Framework\Plugin\Context\UninstallContext;
use SwagMigrationAssistant\SwagMigrationAssistant;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
class IfizzQuickVariants extends Plugin
{
/**
* @param ContainerBuilder $container
*
* @throws Exception
*/
public function build(ContainerBuilder $container): void
{
parent::build($container);
$activePlugins = $container->getParameter('kernel.active_plugins');
if (isset($activePlugins[SwagMigrationAssistant::class])) {
// Only load migration relevant classes if the SwagMigrationAssistant is available
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/DependencyInjection/'));
$loader->load('migration_assistant_extension.xml');
}
}
public function uninstall(UninstallContext $context): void
{
//
// if ($context->keepUserData()) {
// parent::uninstall($context);
//
// return;
// }
//
// $connection = $this->container->get(Connection::class);
//
// $connection->executeUpdate('DROP TABLE IF EXISTS `ifizz_property_group_option_color`');
// $connection->executeUpdate('ALTER TABLE `property_group_option` DROP COLUMN `variant_id`');
//
// parent::uninstall($context);
}
}