custom/plugins/SynSitemapProPlatform/src/SynSitemapProPlatform.php line 13

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Syn\SitemapProPlatform;
  3. use Shopware\Core\Framework\Plugin;
  4. use Shopware\Core\Framework\Plugin\Context\ActivateContext;
  5. use Shopware\Core\Framework\Plugin\Context\InstallContext;
  6. use Shopware\Core\Framework\Plugin\Context\UninstallContext;
  7. use Syn\SitemapProPlatform\Util\Lifecycle\Activator;
  8. use Syn\SitemapProPlatform\Util\Lifecycle\Installer;
  9. use Syn\SitemapProPlatform\Util\Lifecycle\Uninstaller;
  10. class SynSitemapProPlatform extends Plugin
  11. {
  12.     /**
  13.      * @param InstallContext $installContext
  14.      * @return void
  15.      */
  16.     public function install(InstallContext $installContext): void
  17.     {
  18.         parent::install($installContext);
  19.         $installer = new Installer($this->container$installContext);
  20.         $installer->createCustomFieldSet();
  21.     }
  22.     /**
  23.      * @param UninstallContext $uninstallContext
  24.      * @return void
  25.      */
  26.     public function uninstall(UninstallContext $uninstallContext): void
  27.     {
  28.         parent::uninstall($uninstallContext);
  29.         if ($uninstallContext->keepUserData()) {
  30.             return;
  31.         }
  32.         $uninstaller = new Uninstaller($this->container$uninstallContext);
  33.         $uninstaller->deleteCustomFieldSet();
  34.     }
  35.     public function activate(ActivateContext $activateContext): void
  36.     {
  37.         parent::activate($activateContext);
  38.         $installer = new Activator($this->container$activateContext);
  39.         $installer->setSitemapScheduledTaskToScheduled();
  40.     }
  41. }