<?php declare(strict_types=1);
namespace Swp\RealProductVariantsSix;
use Shopware\Core\Framework\Plugin;
use Shopware\Core\Framework\Plugin\Context\ActivateContext;
use Shopware\Core\Framework\Plugin\Context\DeactivateContext;
use Shopware\Core\Framework\Plugin\Context\InstallContext;
use Shopware\Core\Framework\Plugin\Context\UpdateContext;
use Shopware\Core\Framework\Plugin\Context\UninstallContext;
use Swp\RealProductVariantsSix\Utils\CustomFieldInstaller;
use Swp\RealProductVariantsSix\Utils\InstallUninstall;
class SwpRealProductVariantsSix extends Plugin
{
public function install(InstallContext $installContext): void
{
parent::install($installContext);
(new InstallUninstall($this->container))->install($installContext->getContext());
}
public function uninstall(UninstallContext $uninstallContext): void
{
parent::uninstall($uninstallContext);
if ($uninstallContext->keepUserData()) {
return;
}
(new InstallUninstall($this->container))->uninstall($uninstallContext->getContext());
(new CustomFieldInstaller($this->container))->uninstall($uninstallContext->getContext());
}
/**
* @param ActivateContext $activateContext
*/
public function activate(ActivateContext $activateContext): void
{
(new CustomFieldInstaller($this->container))->activate($activateContext->getContext());
parent::activate($activateContext);
}
/**
* @param DeactivateContext $deactivateContext
*/
public function deactivate(DeactivateContext $deactivateContext): void
{
(new CustomFieldInstaller($this->container))->deactivate($deactivateContext->getContext());
parent::deactivate($deactivateContext);
}
/**
* @param UpdateContext $updateContext
* @return void
*/
public function postUpdate(UpdateContext $updateContext): void
{
parent::postUpdate($updateContext);
(new CustomFieldInstaller($this->container))->activate($updateContext->getContext());
}
}