custom/plugins/WabsAuftragsdatenSync/src/WabsAuftragsdatenSync.php line 10

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace WabsAuftragsdatenSync;
  3. use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface;
  4. use Shopware\Core\Framework\Plugin;
  5. use Shopware\Core\Framework\Plugin\Context\ActivateContext;
  6. use Shopware\Core\Framework\Plugin\Context\UpdateContext;
  7. class WabsAuftragsdatenSync extends Plugin
  8. {
  9.     public function getServicesFilePath(): string
  10.     {
  11.         return 'Resources/config/subscriber_service.xml';
  12.     }
  13.     public function activate(ActivateContext $activateContext): void
  14.     {
  15.         $activateContext->setAutoMigrate(true);
  16.     }
  17.     public function update(UpdateContext $updateContext): void
  18.     {
  19.         $updateContext->setAutoMigrate(true);
  20.         /** @var EntityRepositoryInterface $templateTypeRepository */
  21.         $templateTypeRepository $this->container->get('mail_template_type.repository');
  22.         $data = [
  23.             'id' => md5('orderSync.notification'),
  24.             'technicalName' => 'orderSync.notification',
  25.             'name' => 'Auftragsdaten Sync Benachrichtigung',
  26.             'templateData' => ['notifications' => 'Beispiel']
  27.         ];
  28.         $templateTypeRepository->upsert([$data], $updateContext->getContext());
  29.     }
  30. }