custom/plugins/EmailPlugin/src/EmailPlugin.php line 13

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Virgin\EmailPlugin;
  3. use Shopware\Core\Framework\Plugin;
  4. use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface;
  5. use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
  6. use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter;
  7. use Shopware\Core\Content\MailTemplate\Aggregate\MailTemplateType\MailTemplateTypeEntity;
  8. use Shopware\Core\Framework\Plugin\Context\InstallContext;
  9. use Shopware\Core\Framework\Plugin\Context\UninstallContext;
  10. class EmailPlugin extends Plugin
  11. {
  12. public function install(InstallContext $installContext): void
  13. {
  14. // //get the Templates and Associations from the DB
  15. // /** @var EntityRepositoryInterface $mailTemplateTypeRepository */
  16. // $mailTemplateTypeRepository = $this->container->get('mail_template_type.repository');
  17. // /** @var EntityRepositoryInterface $mailTemplateRepository */
  18. // $mailTemplateRepository = $this->container->get('mail_template.repository');
  19. //
  20. // $customMailTemplates = $mailTemplateRepository->search(
  21. // (new Criteria())
  22. // ->addFilter(new EqualsFilter('systemDefault', 0)),
  23. // $installContext
  24. // ->getContext()
  25. // )->getElements();
  26. //
  27. // foreach ($customMailTemplates as $customMailTemplate){
  28. // /** @var MailTemplateTypeEntity $customMailTemplateType */
  29. // $customMailTemplateType = $mailTemplateTypeRepository->search(
  30. // (new Criteria())
  31. // ->addFilter(new EqualsFilter('id', $customMailTemplate->getMailTemplateTypeId())),
  32. // $installContext
  33. // ->getContext()
  34. // )->first();
  35. // //Delete the custom Templates
  36. // $mailTemplateRepository->delete([['id' => $customMailTemplate->getId()]], $installContext->getContext());
  37. //
  38. // //Delete the custom TemplateType
  39. // $mailTemplateTypeRepository->delete([
  40. // ['id' => $customMailTemplateType->getId()]
  41. // ], $installContext->getContext());
  42. // }
  43. // parent::install($installContext);
  44. }
  45. }