<?php declare(strict_types=1);
/**
* @copyright Copyright (c) 2020, Net Inventors GmbH
* @category Shopware
* @author drebrov
*/
namespace NetInventors\NetiNextAccessManager;
use Doctrine\DBAL\DBALException;
use Exception;
use Shopware\Core\Framework\Plugin;
use Shopware\Core\Framework\Plugin\Context\InstallContext;
use Shopware\Core\Framework\Plugin\Context\UninstallContext;
use NetInventors\NetiNextAccessManager\Components\Setup;
use Shopware\Core\Framework\Plugin\Context\UpdateContext;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Class NetiNextAccessManager
*
* @package NetInventors\NetiNextAccessManager
*/
class NetiNextAccessManager extends Plugin
{
/**
* @param InstallContext $installContext
*
* @throws Exception
*/
public function install(InstallContext $installContext): void
{
parent::install($installContext);
if (!$this->container instanceof ContainerInterface) {
return;
}
(new Setup($installContext, $this->container))->install();
}
/**
* @throws Exception
*/
public function update(UpdateContext $updateContext): void
{
parent::update($updateContext);
if (!$this->container instanceof ContainerInterface) {
return;
}
(new Setup($updateContext, $this->container))->update();
}
/**
* @throws DBALException
* @throws Exception
*/
public function uninstall(UninstallContext $uninstallContext): void
{
parent::uninstall($uninstallContext);
if (!$this->container instanceof ContainerInterface) {
return;
}
if ($uninstallContext->keepUserData()) {
return;
}
(new Setup($uninstallContext, $this->container))->uninstall();
}
}