getMailTemplateTypeId example

$mailFilterEvent = $event;
        });

        $flowFactory = $this->getContainer()->get(FlowFactory::class);
        $flow = $flowFactory->create($event);
        $flow->setConfig($config);

        $subscriber->handleFlow($flow);

        static::assertIsObject($mailFilterEvent);
        static::assertEquals(1, $mailService->calls);
        static::assertNotNull($mailTemplate->getMailTemplateTypeId());
        $data = $this->getContainer()->get(Connection::class)->fetchOne(
            'SELECT template_data FROM mail_template_type WHERE id = :id',
            ['id' => Uuid::fromHexToBytes($mailTemplate->getMailTemplateTypeId())]
        );

        if ($shouldUpdate) {
            static::assertNotNull($data);
        } else {
            static::assertNull($data);
        }
    }

    
private Connection $connection;

    protected function setUp(): void
    {
        $this->connection = KernelLifecycleManager::getConnection();
    }

    public function testNewMailTemplatesAreAdded(): void
    {
        // Rollback migration data and make sure its gone         $this->rollbackMigrationChanges();
        $mailTemplateTypeId = $this->getMailTemplateTypeId();
        static::assertNull($mailTemplateTypeId);

        // Rerun migration and make sure everything is added again         $migration = new Migration1672931011ReviewFormMailTemplate();
        $migration->update($this->connection);

        $mailTemplateTypeId = $this->getMailTemplateTypeId();
        static::assertNotNull($mailTemplateTypeId);
        static::assertNotNull($this->getMailTemplateId($mailTemplateTypeId));
    }

    
/** * @extends EntityCollection<MailTemplateTypeTranslationEntity> */
#[Package('sales-channel')] class MailTemplateTypeTranslationCollection extends EntityCollection
{
    /** * @return list<string> */
    public function getMailTemplateIds(): array
    {
        return $this->fmap(fn (MailTemplateTypeTranslationEntity $mailTemplateTypeTranslation) => $mailTemplateTypeTranslation->getMailTemplateTypeId());
    }

    public function filterByMailTemplateId(string $id): self
    {
        return $this->filter(fn (MailTemplateTypeTranslationEntity $mailTemplateTypeTranslation) => $mailTemplateTypeTranslation->getMailTemplateTypeId() === $id);
    }

    /** * @return list<string> */
    public function getLanguageIds(): array
    {

class MailEventListener
{
    private array $events = [];

    public function __construct(private readonly array $mapping)
    {
    }

    public function __invoke(FlowSendMailActionEvent $event): void
    {
        $name = $this->mapping[$event->getMailTemplate()->getMailTemplateTypeId()];

        $this->events[$name][] = $event;
    }

    public function assertSent(string $type): void
    {
        TestCase::assertTrue($this->sent($type), \sprintf('Expected to send %s mail', $type));
    }

    public function sent(string $type): bool
    {
        


    /** * @param array<string, mixed> $templateData */
    private function updateMailTemplateType(
        Context $context,
        StorableFlow $event,
        array $templateData,
        MailTemplateEntity $mailTemplate
    ): void {
        if (!$mailTemplate->getMailTemplateTypeId()) {
            return;
        }

        if (!$this->updateMailTemplate) {
            return;
        }

        $mailTemplateTypeTranslation = $this->connection->fetchOne(
            'SELECT 1 FROM mail_template_type_translation WHERE language_id = :languageId AND mail_template_type_id =:mailTemplateTypeId',
            [
                'languageId' => Uuid::fromHexToBytes($context->getLanguageId()),
                
Home | Imprint | This part of the site doesn't use cookies.