<?php declare(strict_types=1);
namespace NetzpShopmanager6;
use NetzpShopmanager6\Components\Installer;
use NetzpShopmanager6\Components\Uninstaller;
use Shopware\Core\Framework\Plugin;
use Shopware\Core\Framework\Plugin\Context\InstallContext;
use Shopware\Core\Framework\Plugin\Context\UninstallContext;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
class NetzpShopmanager6 extends Plugin
{
public function install(InstallContext $context): void
{
parent::install($context);
(new Installer($this->container))->install();
}
public function uninstall(UninstallContext $context): void
{
parent::uninstall($context);
$this->removeMigrations();
(new Uninstaller($this->container))->uninstall($context);
}
public function build(ContainerBuilder $container): void
{
parent::build($container);
// inject flow builder >= SW 6.4.6.0
if (version_compare($container->getParameter('kernel.shopware_version'), '6.4.6.0', '>=')) {
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/Resources/config'));
$loader->load('services_flowbuilder.xml');
}
}
}