<?php declare(strict_types=1);
namespace Pixel\LexikonSW6;
use Doctrine\DBAL\Connection;
use Shopware\Core\Framework\Plugin;
use Shopware\Core\Framework\Plugin\Context\InstallContext;
use Shopware\Core\Framework\Plugin\Context\UninstallContext;
use Shopware\Core\Framework\Plugin\Context\ActivateContext;
use Shopware\Core\Framework\Plugin\Context\DeactivateContext;
use Shopware\Core\Framework\Plugin\Context\UpdateContext;
class PixelLexikonSW6 extends Plugin
{
public function install(InstallContext $context): void
{
parent::install($context);
}
public function update(UpdateContext $context): void
{
}
public function uninstall(UninstallContext $context): void
{
parent::uninstall($context);
if ($context->keepUserData()) {
return;
}
$connection = $this->container->get(Connection::class);
$connection->executeStatement('SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;');
$connection->executeStatement('DROP TABLE IF EXISTS `pixel_lexikon_categories_translation`');
$connection->executeStatement('DROP TABLE IF EXISTS `pixel_lexikon_categories`');
$connection->executeStatement('DROP TABLE IF EXISTS `pixel_lexikon_translation`');
$connection->executeStatement('DROP TABLE IF EXISTS `pixel_lexikon_categories_ro`');
$connection->executeStatement('DROP TABLE IF EXISTS `pixel_lexikon_sales_channel`');
$connection->executeStatement('DROP TABLE IF EXISTS `pixel_lexikon`');
$connection->executeStatement('DROP TABLE IF EXISTS `pixel_lexikon_media`');
$connection->executeStatement('DROP TABLE IF EXISTS `pixel_lexcat_channels`');
$connection->executeStatement('DROP TABLE IF EXISTS pixel_lexikon_channels`');
$connection->executeStatement('DROP TABLE IF EXISTS pixel_lexikon_products`');
$connection->executeStatement('DELETE FROM `seo_url_template` WHERE `route_name`="frontend.lexikon.listing";');
$connection->executeStatement('DELETE FROM `seo_url_template` WHERE `route_name`="frontend.lexikon.detail";');
$connection->executeStatement('SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;');
}
public function activate(ActivateContext $context): void
{
parent::activate($context);
}
public function deactivate(DeactivateContext $context): void
{
parent::deactivate($context);
}
}