<?php declare(strict_types=1);
namespace WabsAuftragsdatenSync;
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface;
use Shopware\Core\Framework\Plugin;
use Shopware\Core\Framework\Plugin\Context\ActivateContext;
use Shopware\Core\Framework\Plugin\Context\UpdateContext;
class WabsAuftragsdatenSync extends Plugin
{
public function getServicesFilePath(): string
{
return 'Resources/config/subscriber_service.xml';
}
public function activate(ActivateContext $activateContext): void
{
$activateContext->setAutoMigrate(true);
}
public function update(UpdateContext $updateContext): void
{
$updateContext->setAutoMigrate(true);
/** @var EntityRepositoryInterface $templateTypeRepository */
$templateTypeRepository = $this->container->get('mail_template_type.repository');
$data = [
'id' => md5('orderSync.notification'),
'technicalName' => 'orderSync.notification',
'name' => 'Auftragsdaten Sync Benachrichtigung',
'templateData' => ['notifications' => 'Beispiel']
];
$templateTypeRepository->upsert([$data], $updateContext->getContext());
}
}