<?php declare(strict_types=1);
namespace NetInventors\NetiNextOrderFields;
use Doctrine\DBAL\Connection;
use NetInventors\NetiNextOrderFields\Core\Content\Order\Aggregate\OrderAttribute\Aggregate\OrderAttributeValueDefinition;
use NetInventors\NetiNextOrderFields\Core\Content\Order\Aggregate\OrderAttribute\OrderAttributeDefinition;
use NetInventors\NetiNextOrderFields\Core\Content\OrderFields\Aggregate\OrderFieldsCustomerGroup\OrderFieldsCustomerGroupDefinition;
use NetInventors\NetiNextOrderFields\Core\Content\OrderFields\OrderFieldsDefinition;
use Shopware\Core\Framework\Plugin;
use Shopware\Core\Framework\Plugin\Context\UninstallContext;
class NetiNextOrderFields extends Plugin
{
public function uninstall(UninstallContext $uninstallContext): void
{
parent::uninstall($uninstallContext);
if ($uninstallContext->keepUserData()) {
return;
}
$this->deleteTables();
}
protected function deleteTables(): void
{
/** @var Connection $connection */
$connection = $this->container->get(Connection::class);
$connection->executeStatement('DROP TABLE '. OrderAttributeValueDefinition::ENTITY_NAME);
$connection->executeStatement('DROP TABLE '. OrderAttributeDefinition::ENTITY_NAME);
$connection->executeStatement('DROP TABLE '. OrderFieldsDefinition::ENTITY_NAME . '_val_translation');
$connection->executeStatement('DROP TABLE '. OrderFieldsDefinition::ENTITY_NAME . '_val');
$connection->executeStatement('DROP TABLE '. OrderFieldsDefinition::ENTITY_NAME . '_translation');
$connection->executeStatement('DROP TABLE '. OrderFieldsCustomerGroupDefinition::ENTITY_NAME);
$connection->executeStatement('DROP TABLE '. OrderFieldsDefinition::ENTITY_NAME);
}
}