custom/static-plugins/MadProductVisibility/src/MadProductVisibility.php line 11

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace MadProductVisibility;
  3. use Doctrine\DBAL\Connection;
  4. use Shopware\Core\Framework\DataAbstractionLayer\Indexing\EntityIndexerRegistry;
  5. use Shopware\Core\Framework\Plugin;
  6. use Shopware\Core\Framework\Plugin\Context\ActivateContext;
  7. use Shopware\Core\Framework\Plugin\Context\UninstallContext;
  8. class MadProductVisibility extends Plugin
  9. {
  10.     public function activate(ActivateContext $activateContext): void
  11.     {
  12.         $registry $this->container->get(EntityIndexerRegistry::class);
  13.         $registry->sendIndexingMessage(['product.indexer']);
  14.     }
  15.     public function uninstall(UninstallContext $uninstallContext): void
  16.     {
  17.         parent::uninstall($uninstallContext);
  18.         if ($uninstallContext->keepUserData()) {
  19.             return;
  20.         }
  21.         $connection $this->container->get(Connection::class);
  22.         $connection->executeUpdate('DROP TABLE IF EXISTS `mad_product_role_blacklist`');
  23.         $connection->executeUpdate('ALTER TABLE `product` DROP COLUMN `madProductRoleBlacklist`');
  24.     }
  25. }