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

Open in your IDE?
  1. <?php
  2. namespace Biloba\IntlTranslationMoreEntities;
  3. use Doctrine\DBAL\Connection;
  4. use Shopware\Core\Framework\Plugin;
  5. use Shopware\Core\Framework\Plugin\Context\UninstallContext;
  6. class BilobaIntlTranslationMoreEntities extends Plugin
  7. {
  8.     public function uninstall(UninstallContext $context): void
  9.     {
  10.         parent::uninstall($context);
  11.         if ($context->keepUserData()) {
  12.             return;
  13.         }
  14.         $connection $this->container->get(Connection::class);
  15.         // Delete all translations when uninstalling the plugin
  16.         $connection->exec('DELETE `product_manufacturer_translation` FROM `product_manufacturer_translation` LEFT JOIN `biloba_intl_translation_log` ON `biloba_intl_translation_log`.`entity_id` = `product_manufacturer_translation`.`product_manufacturer_id`
  17.         WHERE `biloba_intl_translation_log`.`target_language_id` = `product_manufacturer_translation`.`language_id`');
  18.         $connection->exec('DELETE `category_translation` FROM `category_translation` LEFT JOIN `biloba_intl_translation_log` ON `biloba_intl_translation_log`.`entity_id` = `category_translation`.`category_id`
  19.         WHERE `biloba_intl_translation_log`.`target_language_id` = `category_translation`.`language_id`');
  20.         $connection->exec('DELETE `property_group_translation` FROM `property_group_translation` LEFT JOIN `biloba_intl_translation_log` ON `biloba_intl_translation_log`.`entity_id` = `property_group_translation`.`property_group_id`
  21.         WHERE `biloba_intl_translation_log`.`target_language_id` = `property_group_translation`.`language_id`');
  22.         $connection->exec('DELETE `product_stream_translation` FROM `product_stream_translation` LEFT JOIN `biloba_intl_translation_log` ON `biloba_intl_translation_log`.`entity_id` = `product_stream_translation`.`product_stream_id`
  23.         WHERE `biloba_intl_translation_log`.`target_language_id` = `product_stream_translation`.`language_id`');
  24.         $connection->exec('DELETE `mail_template_translation` FROM `mail_template_translation` LEFT JOIN `biloba_intl_translation_log` ON `biloba_intl_translation_log`.`entity_id` = `mail_template_translation`.`mail_template_id`
  25.         WHERE `biloba_intl_translation_log`.`target_language_id` = `mail_template_translation`.`language_id`');
  26.         
  27.     }
  28. }