<?php declare(strict_types=1);
namespace Nimbits\NimbitsPriceOnRequestNext;
use Shopware\Core\Framework\Plugin;
use Shopware\Core\Framework\Context;
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 Shopware\Core\Framework\CustomField\CustomFieldTypes;
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter;
use Shopware\Core\Framework\DataAbstractionLayer\Search\IdSearchResult;
use Shopware\Core\System\SystemConfig\SystemConfigDefinition;
use Doctrine\DBAL\Connection;
use Shopware\Core\Framework\Uuid\Uuid;
use Shopware\Core\Defaults;
use Nimbits\NimbitsPriceOnRequestNext\Schema\SchemaUpgrade;
class NimbitsPriceOnRequestNext extends Plugin
{
public function getViewPaths(): array
{
$viewPaths = parent::getViewPaths();
$viewPaths[] = 'Resources/views/storefront';
return $viewPaths;
}
public function activate(ActivateContext $context): void
{
parent::activate($context);
SchemaUpgrade::activate($context, $this->container);
}
public function deactivate(DeactivateContext $context): void
{
$shopwareContext = $context->getContext();
parent::deactivate($context);
SchemaUpgrade::deactivate($context, $this->container);
}
public function install(InstallContext $context): void
{
parent::install($context);
SchemaUpgrade::install($context, $this->container);
}
public function update(UpdateContext $context): void
{
parent::update($context);
SchemaUpgrade::update($context, $this->container);
}
public function uninstall(UninstallContext $context): void
{
parent::uninstall($context);
if ($context->keepUserData())
return;
try{
$connection = $this->container->get(Connection::class);
$connection->executeQuery('DROP TABLE IF EXISTS `nimbits_pricerequests`');
$connection->executeQuery('DROP TABLE IF EXISTS `nimbits_pricerequests_baskets`');
}
catch(\Exception $e){
}
SchemaUpgrade::uninstall($context, $this->container);
}
}