custom/plugins/NimbitsPriceOnRequestNext/src/NimbitsPriceOnRequestNext.php line 24

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Nimbits\NimbitsPriceOnRequestNext;
  3. use Shopware\Core\Framework\Plugin;
  4. use Shopware\Core\Framework\Context;
  5. use Shopware\Core\Framework\Plugin\Context\ActivateContext;
  6. use Shopware\Core\Framework\Plugin\Context\DeactivateContext;
  7. use Shopware\Core\Framework\Plugin\Context\InstallContext;
  8. use Shopware\Core\Framework\Plugin\Context\UpdateContext;
  9. use Shopware\Core\Framework\Plugin\Context\UninstallContext;
  10. use Shopware\Core\Framework\CustomField\CustomFieldTypes;
  11. use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface;
  12. use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
  13. use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter;
  14. use Shopware\Core\Framework\DataAbstractionLayer\Search\IdSearchResult;
  15. use Shopware\Core\System\SystemConfig\SystemConfigDefinition;
  16. use Doctrine\DBAL\Connection;
  17. use Shopware\Core\Framework\Uuid\Uuid;
  18. use Shopware\Core\Defaults;
  19. use Nimbits\NimbitsPriceOnRequestNext\Schema\SchemaUpgrade;
  20. class NimbitsPriceOnRequestNext extends Plugin
  21. {
  22.     
  23.     public function getViewPaths(): array
  24.     {
  25.         $viewPaths parent::getViewPaths();
  26.         $viewPaths[] = 'Resources/views/storefront';
  27.         return $viewPaths;
  28.     }
  29.     
  30.     public function activate(ActivateContext $context): void
  31.     {
  32.         parent::activate($context);
  33.         SchemaUpgrade::activate($context$this->container);
  34.     }
  35.     
  36.     public function deactivate(DeactivateContext $context): void
  37.     {
  38.         $shopwareContext $context->getContext();
  39.         parent::deactivate($context);
  40.         SchemaUpgrade::deactivate($context$this->container);
  41.     }
  42.     
  43.     public function install(InstallContext $context): void
  44.     {
  45.         parent::install($context);
  46.         SchemaUpgrade::install($context$this->container);
  47.     }
  48.     public function update(UpdateContext $context): void
  49.     {
  50.         parent::update($context);
  51.         SchemaUpgrade::update($context$this->container);
  52.     }
  53.     
  54.     public function uninstall(UninstallContext $context): void
  55.     {
  56.         parent::uninstall($context);
  57.         
  58.         if ($context->keepUserData())
  59.             return;
  60.         
  61.         try{
  62.             $connection $this->container->get(Connection::class);
  63.             $connection->executeQuery('DROP TABLE IF EXISTS `nimbits_pricerequests`');
  64.             $connection->executeQuery('DROP TABLE IF EXISTS `nimbits_pricerequests_baskets`');
  65.             
  66.             
  67.         }
  68.         catch(\Exception $e){
  69.             
  70.         }
  71.         
  72.         SchemaUpgrade::uninstall($context$this->container);
  73.         
  74.     }
  75.     
  76. }