custom/plugins/SwpRealProductVariantsSix/src/SwpRealProductVariantsSix.php line 14

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Swp\RealProductVariantsSix;
  3. use Shopware\Core\Framework\Plugin;
  4. use Shopware\Core\Framework\Plugin\Context\ActivateContext;
  5. use Shopware\Core\Framework\Plugin\Context\DeactivateContext;
  6. use Shopware\Core\Framework\Plugin\Context\InstallContext;
  7. use Shopware\Core\Framework\Plugin\Context\UpdateContext;
  8. use Shopware\Core\Framework\Plugin\Context\UninstallContext;
  9. use Swp\RealProductVariantsSix\Utils\CustomFieldInstaller;
  10. use Swp\RealProductVariantsSix\Utils\InstallUninstall;
  11. class SwpRealProductVariantsSix extends Plugin
  12. {
  13.     public function install(InstallContext $installContext): void
  14.     {
  15.         parent::install($installContext);
  16.         (new InstallUninstall($this->container))->install($installContext->getContext());
  17.     }
  18.     public function uninstall(UninstallContext $uninstallContext): void
  19.     {
  20.         parent::uninstall($uninstallContext);
  21.         if ($uninstallContext->keepUserData()) {
  22.             return;
  23.         }
  24.         (new InstallUninstall($this->container))->uninstall($uninstallContext->getContext());
  25.         (new CustomFieldInstaller($this->container))->uninstall($uninstallContext->getContext());
  26.     }
  27.     /**
  28.      * @param ActivateContext $activateContext
  29.      */
  30.     public function activate(ActivateContext $activateContext): void
  31.     {
  32.         (new CustomFieldInstaller($this->container))->activate($activateContext->getContext());
  33.         parent::activate($activateContext);
  34.     }
  35.     /**
  36.      * @param DeactivateContext $deactivateContext
  37.      */
  38.     public function deactivate(DeactivateContext $deactivateContext): void
  39.     {
  40.         (new CustomFieldInstaller($this->container))->deactivate($deactivateContext->getContext());
  41.         parent::deactivate($deactivateContext);
  42.     }
  43.     /**
  44.      * @param UpdateContext $updateContext
  45.      * @return void
  46.      */
  47.     public function postUpdate(UpdateContext $updateContext): void
  48.     {
  49.         parent::postUpdate($updateContext);
  50.         (new CustomFieldInstaller($this->container))->activate($updateContext->getContext());
  51.     }
  52. }