custom/plugins/IntediaDoofinderSW6/src/IntediaDoofinderSW6.php line 16

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Intedia\Doofinder;
  3. use Intedia\Doofinder\Core\Content\ProductExport\Service\ExportHandler;
  4. use Shopware\Core\Framework\Plugin;
  5. use Shopware\Core\Framework\Plugin\Context\ActivateContext;
  6. use Shopware\Core\Framework\Plugin\Context\InstallContext;
  7. use Shopware\Core\Framework\Plugin\Context\UninstallContext;
  8. use Shopware\Core\Framework\Plugin\Context\UpdateContext;
  9. /**
  10.  * Class IntediaDoofinderSW6
  11.  * @package Intedia\Doofinder
  12.  */
  13. class IntediaDoofinderSW6 extends Plugin
  14. {
  15.     /**
  16.      * {@inheritDoc}
  17.      */
  18.     public function activate(ActivateContext $activateContext): void
  19.     {
  20.     }
  21.     /**
  22.      * {@inheritdoc}
  23.      */
  24.     public function install(InstallContext $installContext): void
  25.     {
  26.         $exportHandler = new ExportHandler($this->container->get('product_export.repository'), $this->container->get('product_stream.repository'), $this->container->get('sales_channel.repository'));
  27.         $exportHandler->createDoofinderExportIfRequired();
  28.     }
  29.     /**
  30.      * {@inheritdoc}
  31.      */
  32.     public function update(UpdateContext $updateContext): void
  33.     {
  34.         $exportHandler = new ExportHandler($this->container->get('product_export.repository'), $this->container->get('product_stream.repository'), $this->container->get('sales_channel.repository'));
  35.         switch ($updateContext->getUpdatePluginVersion()) {
  36.             case '1.0.1':
  37.                 $exportHandler->updateDoofinderExport101();
  38.             case '1.0.2':
  39.                 // Nothing
  40.             case '1.0.3':
  41.                 // Nothing
  42.             case '1.0.4':
  43.                 // Nothing
  44.             case '1.0.5':
  45.                 $exportHandler->updateDoofinderExport105();
  46.             case '1.0.6':
  47.             case '1.0.7':
  48.                 // Nothing
  49.         }
  50.     }
  51.     /**
  52.      * {@inheritdoc}
  53.      */
  54.     public function uninstall(UninstallContext $uninstallContext): void
  55.     {
  56.         if (!$uninstallContext->keepUserData()) {
  57.             $exportHandler = new ExportHandler($this->container->get('product_export.repository'), $this->container->get('product_stream.repository'), $this->container->get('sales_channel.repository'));
  58.             $exportHandler->deleteDooFinderExport();
  59.             $exportHandler->deleteDooFinderStream();
  60.         }
  61.     }
  62. }