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

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