<?php declare(strict_types=1);
namespace Biloba\IntlTranslation;
use Doctrine\DBAL\Connection;
use Shopware\Core\Framework\Plugin;
use Shopware\Core\Framework\Plugin\Context\UninstallContext;
class BilobaIntlTranslation extends Plugin
{
public function uninstall(UninstallContext $context): void
{
parent::uninstall($context);
$connection = $this->container->get(Connection::class);
// Delete all translations when uninstalling the plugin
$connection->exec('DELETE `product_translation` FROM `product_translation` LEFT JOIN `biloba_intl_translation_log` ON `biloba_intl_translation_log`.`entity_id` = `product_translation`.`product_id`
WHERE `biloba_intl_translation_log`.`target_language_id` = `product_translation`.`language_id`');
$connection->exec('DROP TABLE IF EXISTS `biloba_intl_translation_config`');
$connection->exec('DROP TABLE IF EXISTS `biloba_intl_translation_log`');
}
}