<?php
namespace BAL\Plugin\ThreeDimensionModelView;
use Doctrine\DBAL\Connection;
use Shopware\Core\Framework\Plugin;
use Shopware\Core\Framework\Plugin\Context\UninstallContext;
class BALThreeDimensionModelView extends Plugin
{
public function uninstall(UninstallContext $uninstallContext) : void
{
parent::uninstall($uninstallContext);
if ($uninstallContext->keepUserData()) {
return;
}
/** @var Connection $connection */
$connection = $this->container->get(Connection::class);
/** @noinspection SqlNoDataSourceInspection */
$connection->executeStatement(
"
DROP TABLE IF EXISTS bal_three_dimension_model_category_extension;
DROP TABLE IF EXISTS bal_three_dimension_model_product;
DROP TABLE IF EXISTS bal_three_dimension_model;
ALTER TABLE product DROP COLUMN threeDimensionModels;
UPDATE media_folder as mf
LEFT JOIN media_default_folder as mdf ON mf.default_folder_id = mdf.id
SET mf.name = concat(name, ' (ARCHIVE)')
WHERE mdf.entity = 'bal_three_dimension_model';
DELETE FROM media_default_folder WHERE `entity` = 'bal_three_dimension_model';
DELETE FROM system_config WHERE configuration_key LIKE 'BALThreeDimensionModelView.config.%';
"
);
}
}