vendor/store.shopware.com/nimbitsarticlequestionsnext/src/NimbitsArticleQuestionsNext.php line 21

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Nimbits\NimbitsArticleQuestionsNext;
  3. use Shopware\Core\Framework\Plugin;
  4. use Shopware\Core\Framework\Context;
  5. use Shopware\Core\Framework\Plugin\Context\ActivateContext;
  6. use Shopware\Core\Framework\Plugin\Context\DeactivateContext;
  7. use Shopware\Core\Framework\Plugin\Context\InstallContext;
  8. use Shopware\Core\Framework\Plugin\Context\UninstallContext;
  9. use Shopware\Core\Framework\CustomField\CustomFieldTypes;
  10. use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface;
  11. use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
  12. use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter;
  13. use Shopware\Core\Framework\DataAbstractionLayer\Search\IdSearchResult;
  14. use Shopware\Core\System\SystemConfig\SystemConfigDefinition;
  15. use Doctrine\DBAL\Connection;
  16. use Shopware\Core\Framework\Uuid\Uuid;
  17. use Shopware\Core\Defaults;
  18. class NimbitsArticleQuestionsNext extends Plugin
  19. {
  20.     public function getViewPaths(): array
  21.     {
  22.         $viewPaths parent::getViewPaths();
  23.         $viewPaths[] = 'Resources/views/storefront';
  24.         return $viewPaths;
  25.     }
  26.     public function activate(ActivateContext $context): void
  27.     {
  28.         parent::activate($context);
  29.     }
  30.     public function deactivate(DeactivateContext $context): void
  31.     {
  32.         $shopwareContext $context->getContext();
  33.         parent::deactivate($context);
  34.     }
  35.     public function install(InstallContext $context): void
  36.     {
  37.         parent::install($context);
  38.     }
  39.     public function uninstall(UninstallContext $context): void
  40.     {
  41.         parent::uninstall($context);
  42.         if($context->keepUserData()){
  43.             return;
  44.         }
  45.         $connection $this->container->get(Connection::class);
  46.         $connection->executeStatement('DROP TABLE IF EXISTS `nimbits_articlequestions`');
  47.         //shopowner mail loeschen
  48.         $sql "DELETE mail_template_type.*, mail_template_type_translation.*, mail_template_translation.*, mail_template.*
  49.                 FROM mail_template_type
  50.                 JOIN mail_template_type_translation 
  51.                     ON mail_template_type_translation.mail_template_type_id = mail_template_type.id
  52.                 JOIN mail_template 
  53.                     ON mail_template.mail_template_type_id = mail_template_type.id
  54.                 JOIN mail_template_translation 
  55.                     ON mail_template_translation.mail_template_id = mail_template.id
  56.                 WHERE mail_template_type.technical_name = 'nimbits_aq_emailshopowner'";
  57.         $connection->executeStatement($sql);
  58.         //customer request mail loeschen
  59.         $sql "DELETE mail_template_type.*, mail_template_type_translation.*, mail_template_translation.*, mail_template.*
  60.                 FROM mail_template_type
  61.                 JOIN mail_template_type_translation 
  62.                     ON mail_template_type_translation.mail_template_type_id = mail_template_type.id
  63.                 JOIN mail_template 
  64.                     ON mail_template.mail_template_type_id = mail_template_type.id
  65.                 JOIN mail_template_translation 
  66.                     ON mail_template_translation.mail_template_id = mail_template.id
  67.                 WHERE mail_template_type.technical_name = 'nimbits_aq_emailcustomer'";
  68.         $connection->executeStatement($sql);
  69.         //customer answer mail loeschen
  70.         $sql "DELETE mail_template_type.*, mail_template_type_translation.*, mail_template_translation.*, mail_template.*
  71.                 FROM mail_template_type
  72.                 JOIN mail_template_type_translation 
  73.                     ON mail_template_type_translation.mail_template_type_id = mail_template_type.id
  74.                 JOIN mail_template 
  75.                     ON mail_template.mail_template_type_id = mail_template_type.id
  76.                 JOIN mail_template_translation 
  77.                     ON mail_template_translation.mail_template_id = mail_template.id
  78.                 WHERE mail_template_type.technical_name = 'nimbits_aq_emailcustomeranswer'";
  79.         $connection->executeStatement($sql);
  80.         $sql "DELETE FROM mail_template WHERE mail_template.mail_template_type_id IS NULL";
  81.         $connection->executeStatement($sql);
  82.     }
  83. }