<?php
declare(strict_types=1);
namespace Lnb\Shopware6\LnbProductReview;
use Doctrine\DBAL\Connection;
use Lnb\Shopware6\LnbProductReview\Extension\Content\Product\Aggregate\ProductReviewExtensionDefinition;
use Shopware\Core\Framework\Plugin;
use Shopware\Core\Framework\Plugin\Context\UninstallContext;
class LnbProductReview extends Plugin
{
public function uninstall(UninstallContext $uninstallContext): void
{
if ($uninstallContext->keepUserData()) {
return;
}
$classNames = [ProductReviewExtensionDefinition::ENTITY_NAME];
if (!$this->container) {
return;
}
/** @var Connection $connection */
$connection = $this->container->get(Connection::class);
foreach ($classNames as $className) {
$connection->executeStatement(sprintf('DROP TABLE IF EXISTS `%s`', $className));
}
}
}