<?php declare(strict_types=1);
namespace Intedia\Doofinder;
use Intedia\Doofinder\Core\Content\ProductExport\Service\ExportHandler;
use Shopware\Core\Framework\Plugin;
use Shopware\Core\Framework\Plugin\Context\ActivateContext;
use Shopware\Core\Framework\Plugin\Context\InstallContext;
use Shopware\Core\Framework\Plugin\Context\UninstallContext;
use Shopware\Core\Framework\Plugin\Context\UpdateContext;
/**
* Class IntediaDoofinderSW6
* @package Intedia\Doofinder
*/
class IntediaDoofinderSW6 extends Plugin
{
/**
* {@inheritDoc}
*/
public function activate(ActivateContext $activateContext): void
{
}
/**
* {@inheritdoc}
*/
public function install(InstallContext $installContext): void
{
$exportHandler = new ExportHandler($this->container->get('product_export.repository'), $this->container->get('product_stream.repository'), $this->container->get('sales_channel.repository'));
$exportHandler->createDoofinderExportIfRequired();
}
/**
* {@inheritdoc}
*/
public function update(UpdateContext $updateContext): void
{
$exportHandler = new ExportHandler($this->container->get('product_export.repository'), $this->container->get('product_stream.repository'), $this->container->get('sales_channel.repository'));
switch ($updateContext->getUpdatePluginVersion()) {
case '1.0.1':
$exportHandler->updateDoofinderExport101();
case '1.0.2':
// Nothing
case '1.0.3':
// Nothing
case '1.0.4':
// Nothing
case '1.0.5':
$exportHandler->updateDoofinderExport105();
case '1.0.6':
case '1.0.7':
// Nothing
}
}
/**
* {@inheritdoc}
*/
public function uninstall(UninstallContext $uninstallContext): void
{
if (!$uninstallContext->keepUserData()) {
$exportHandler = new ExportHandler($this->container->get('product_export.repository'), $this->container->get('product_stream.repository'), $this->container->get('sales_channel.repository'));
$exportHandler->deleteDooFinderExport();
$exportHandler->deleteDooFinderStream();
}
}
}