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

  1. <?php
  2. declare(strict_types=1);
  3. namespace Blur\BlurElysiumSlider;
  4. use Symfony\Component\DependencyInjection\ContainerInterface;
  5. use Shopware\Core\Framework\Plugin;
  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. use Blur\BlurElysiumSlider\Bootstrap\Lifecycle;
  10. class BlurElysiumSlider extends Plugin
  11. {
  12.     public function postInstall(InstallContext $installContext): void
  13.     {
  14.         /** @var ContainerInterface $container */
  15.         $container $this->container;
  16.         $lifecycle = new Lifecycle($container);
  17.         $lifecycle->install($installContext->getContext());
  18.     }
  19.     public function postUpdate(UpdateContext $updateContext): void
  20.     {
  21.         /** @var ContainerInterface $container */
  22.         $container $this->container;
  23.         $lifecycle = new Lifecycle($container);
  24.         $lifecycle->postUpdate($updateContext);
  25.     }
  26.     public function uninstall(UninstallContext $uninstallContext): void
  27.     {
  28.         /** @var ContainerInterface $container */
  29.         $container $this->container;
  30.         $uninstallContext->setAutoMigrate(false); /// disable auto migration execution
  31.         $migrationCollection $uninstallContext->getMigrationCollection(); /// get migration collection
  32.         if ($uninstallContext->keepUserData() === false) {
  33.             /// call updateDestructive and remove entity from database
  34.             $migrationCollection->migrateDestructiveInPlace(1624100471);
  35.             /// remove media folder and according default folder
  36.             $lifecycle = new Lifecycle($container);
  37.             $lifecycle->uninstall($uninstallContext->getContext());
  38.         }
  39.     }
  40. }