<?php declare(strict_types=1);
namespace HrznApiConnector;
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\UninstallContext;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
class HrznApiConnector extends Plugin
{
public const PLUGIN_TABLE = 'merchant_product';
public function build(ContainerBuilder $container): void
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/DependencyInjection'));
$loader->load('services.xml');
parent::build($container);
}
public function Install(InstallContext $context): void
{
parent::Install($context);
}
public function activate(ActivateContext $activateContext): void
{
parent::activate($activateContext);
}
public function deactivate(DeactivateContext $deactivateContext): void
{
parent::deactivate($deactivateContext);
}
public function uninstall(UninstallContext $context): void
{
parent::uninstall($context);
if ($context->keepUserData()) {
return;
}
// TODO enable only in case of need!!
//$connection = $this->container->get(Connection::class);
//$connection->executeStatement('DROP TABLE IF EXISTS `' . self::PLUGIN_TABLE . '`');
}
}