custom/plugins/SwagPlatformDemoData/src/SwagPlatformDemoData.php line 9

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Swag\PlatformDemoData;
  3. use Shopware\Core\Framework\Plugin;
  4. use Shopware\Core\Framework\Plugin\Context\ActivateContext;
  5. use Shopware\Core\Framework\Plugin\Context\UninstallContext;
  6. class SwagPlatformDemoData extends Plugin
  7. {
  8.     private DemoDataService $demoDataService;
  9.     public function activate(ActivateContext $activateContext): void
  10.     {
  11.         $this->demoDataService->generate($activateContext->getContext());
  12.     }
  13.     public function uninstall(UninstallContext $uninstallContext): void
  14.     {
  15.         if ($uninstallContext->keepUserData()) {
  16.             return;
  17.         }
  18.         $this->demoDataService->delete($uninstallContext->getContext());
  19.     }
  20.     /**
  21.      * @required
  22.      */
  23.     public function setDemoDataService(DemoDataService $demoDataService): void
  24.     {
  25.         $this->demoDataService $demoDataService;
  26.     }
  27. }