custom/plugins/MoorlCmsBrandSlider/src/MoorlCmsBrandSlider.php line 12
<?php declare(strict_types=1);namespace MoorlCmsBrandSlider;use Doctrine\DBAL\Connection;use MoorlFoundation\Core\Service\DataService;use Shopware\Core\Framework\Plugin;use Shopware\Core\Framework\Plugin\Context\ActivateContext;use Shopware\Core\Framework\Plugin\Context\InstallContext;use Shopware\Core\Framework\Plugin\Context\UninstallContext;class MoorlCmsBrandSlider extends Plugin{final public const NAME = 'MoorlCmsBrandSlider';final public const DATA_CREATED_AT = '2021-11-07 00:00:00.000';final public const PLUGIN_TABLES = [];final public const SHOPWARE_TABLES = ['cms_page','cms_page_translation','cms_section','cms_block','cms_slot','category','product_manufacturer','moorl_sorting'];public function install(InstallContext $context): void{parent::install($context);}public function activate(ActivateContext $activateContext): void{parent::activate($activateContext); // TODO: Change the autogenerated stub/* @var $dataService DataService */$dataService = $this->container->get(DataService::class);$dataService->install(self::NAME);}public function uninstall(UninstallContext $uninstallContext): void{parent::uninstall($uninstallContext);if ($uninstallContext->keepUserData()) {return;}$this->uninstallTrait();}private function uninstallTrait(): void{$connection = $this->container->get(Connection::class);foreach (self::PLUGIN_TABLES as $table) {$sql = sprintf('SET FOREIGN_KEY_CHECKS=0; DROP TABLE IF EXISTS `%s`;', $table);$connection->executeUpdate($sql);}foreach (array_reverse(self::SHOPWARE_TABLES) as $table) {$sql = sprintf("SET FOREIGN_KEY_CHECKS=0; DELETE FROM `%s` WHERE `created_at` = '%s';", $table, self::DATA_CREATED_AT);try {$connection->executeUpdate($sql);} catch (\Exception) {continue;}}}}