custom/plugins/MoorlProductAccessories/src/MoorlProductAccessories.php line 11

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace MoorlProductAccessories;
  3. use Doctrine\DBAL\Connection;
  4. use MoorlFoundation\Core\PluginFoundation;
  5. use Shopware\Core\Framework\Plugin;
  6. use Shopware\Core\Framework\Plugin\Context\InstallContext;
  7. use Shopware\Core\Framework\Plugin\Context\UninstallContext;
  8. class MoorlProductAccessories extends Plugin
  9. {
  10.     public const NAME 'MoorlProductAccessories';
  11.     public const DATA_CREATED_AT '2003-05-03 03:03:04.000';
  12.     public const CMS_PAGE 'moorl_pa_accessory';
  13.     public const CMS_PAGE_ID '9ce427efc86506801daedbf910f75bc4';
  14.     public const PLUGIN_TABLES = [
  15.         'moorl_pa_category',
  16.         'moorl_pa_category_translation',
  17.         'moorl_pa_accessory',
  18.         'moorl_pa_product_category',
  19.     ];
  20.     public const SHOPWARE_TABLES = [
  21.         'media_folder',
  22.         'cms_page',
  23.         'cms_page_translation',
  24.         'cms_section',
  25.         'cms_block',
  26.         'category',
  27.         'category_translation',
  28.         'product',
  29.         'product_translation',
  30.         'product_category',
  31.         'product_visibility'
  32.     ];
  33.     public function install(InstallContext $installContext): void
  34.     {
  35.         parent::install($installContext);
  36.         /* @var $foundation PluginFoundation */
  37.         $foundation $this->container->get(PluginFoundation::class);
  38.         $foundation->setContext($installContext->getContext());
  39.     }
  40.     public function uninstall(UninstallContext $context): void
  41.     {
  42.         parent::uninstall($context);
  43.         if ($context->keepUserData()) {
  44.             return;
  45.         }
  46.         /* @var $foundation PluginFoundation */
  47.         $foundation $this->container->get(PluginFoundation::class);
  48.         $foundation->setContext($context->getContext());
  49.         $foundation->dropTables([
  50.             'moorl_pa_accessory',
  51.             'moorl_pa_category_translation',
  52.             'moorl_pa_category'
  53.         ]);
  54.         $foundation->removePluginSnippets('moorl-product-accessories');
  55.         $foundation->removePluginConfig('MoorlProductAccessories');
  56.         $foundation->removeCmsBlocks(['moorl-product-accessories-basic']);
  57.     }
  58. }