<?php
declare(strict_types=1);
namespace NetInventors\NetiNextEasyCouponGenerator;
use Doctrine\DBAL\DBALException;
use Shopware\Core\Framework\Plugin;
use NetInventors\NetiNextEasyCouponGenerator\Components\Setup;
use Shopware\Core\Framework\Plugin\Context\InstallContext;
use Shopware\Core\Framework\Plugin\Context\UninstallContext;
/** @psalm-suppress PropertyNotSetInConstructor */
class NetiNextEasyCouponGenerator extends Plugin
{
/**
* @param InstallContext $installContext
*
* @throws \Throwable
*/
public function install(InstallContext $installContext): void
{
parent::install($installContext);
if (isset($this->container)) {
(new Setup($installContext, $this->container))->install();
}
}
/**
* @param UninstallContext $uninstallContext
*
* @throws DBALException
*/
public function uninstall(UninstallContext $uninstallContext): void
{
parent::uninstall($uninstallContext);
if ($uninstallContext->keepUserData()) {
return;
}
if (isset($this->container)) {
(new Setup($uninstallContext, $this->container))->uninstall();
}
}
}