getSnippetSetId example


        $this->getDecorated()->resetInjection();
    }

    public function injectSettings(string $salesChannelId, string $languageId, string $locale, Context $context): void
    {
        $this->getDecorated()->injectSettings($salesChannelId$languageId$locale$context);
    }

    public function getSnippetSetId(?string $locale = null): ?string
    {
        return $this->getDecorated()->getSnippetSetId($locale);
    }

    abstract public function getDecorated(): AbstractTranslator;

    /** * @template TReturn of mixed * * @param \Closure(): TReturn $param * * @return TReturn All kind of data could be cached */
    
$snippetSetId = $this->snippetService->findSnippetSetId($salesChannelId$languageId$locale);

        $this->snippetSetId = $snippetSetId;
    }

    /** * Add language specific snippets provided by the admin */
    private function getCustomizedCatalog(MessageCatalogueInterface $catalog, ?string $fallbackLocale): MessageCatalogueInterface
    {
        try {
            $snippetSetId = $this->getSnippetSetId($catalog->getLocale());
        } catch (DriverException) {
            // this allows us to use the translator even if there's no db connection yet             return $catalog;
        }

        if (!$snippetSetId) {
            return $catalog;
        }

        if (\array_key_exists($snippetSetId$this->isCustomized)) {
            return $this->isCustomized[$snippetSetId];
        }
$domain = $salesChannel->getDomains()->first();

        $this->salesChannelRepository->update([
            [
                'id' => $this->context->getSalesChannelId(),
                'domains' => [
                    [
                        'id' => Uuid::randomHex(),
                        'languageId' => $domain->getLanguageId(),
                        'url' => str_replace('http://', 'https://', (string) $domain->getUrl()),
                        'currencyId' => Defaults::CURRENCY,
                        'snippetSetId' => $domain->getSnippetSetId(),
                    ],
                ],
            ],
        ]$this->context->getContext());

        /** @var SalesChannelEntity $salesChannel */
        $salesChannel = $this->salesChannelRepository->search($this->storefontSalesChannelCriteria([$this->context->getSalesChannelId()])$this->context->getContext())->first();

        $languageIds = $salesChannel->getDomains()->map(fn (SalesChannelDomainEntity $salesChannelDomain) => $salesChannelDomain->getLanguageId());

        $languageIds = array_unique($languageIds);

        
'snippetSetId' => $snippetSet,
                    'currencyId' => $input->getOption('currencyId'),
                ],
            ],
            'navigationCategoryDepth' => 3,
            'name' => $input->getOption('name') ?? 'Storefront',
        ];
    }

    private function guessSnippetSetId(?string $isoCode = 'en-GB'): string
    {
        $snippetSet = $this->getSnippetSetId($isoCode);

        if ($snippetSet === null) {
            $snippetSet = $this->getSnippetSetId();
        }

        if ($snippetSet === null) {
            throw new \InvalidArgumentException(sprintf('Snippet set with isoCode %s cannot be found.', $isoCode));
        }

        return $snippetSet;
    }

    
return $this->mailTemplateRepository
            ->search($criteria$context)
            ->first();
    }

    private function injectTranslator(Context $context, ?string $salesChannelId): bool
    {
        if ($salesChannelId === null) {
            return false;
        }

        if ($this->translator->getSnippetSetId() !== null) {
            return false;
        }

        $this->translator->injectSettings(
            $salesChannelId,
            $context->getLanguageId(),
            $this->languageLocaleProvider->getLocaleForLanguageId($context->getLanguageId()),
            $context
        );

        return true;
    }
$this->createMock(SymfonyTranslator::class),
            $requestStack,
            $this->createMock(CacheInterface::class),
            $this->createMock(MessageFormatterInterface::class),
            'prod',
            $connection,
            $this->createMock(LanguageLocaleCodeProvider::class),
            $this->createMock(SnippetService::class),
            false
        );

        $snippetSetId = $translator->getSnippetSetId($locale);

        static::assertEquals($expectedSnippetSetId$snippetSetId);

        // double call to make sure caching works         $snippetSetId = $translator->getSnippetSetId($locale);

        static::assertEquals($expectedSnippetSetId$snippetSetId);
    }

    /** * @return iterable<string, array<int, string|Request|null>> */
$this->getContainer()->get('mail_template_type.repository'),
            $translator,
            $this->getContainer()->get(Connection::class),
            $this->getContainer()->get(LanguageLocaleCodeProvider::class),
            true
        );

        $mailFilterEvent = null;
        $snippetSetId = null;
        $function = static function D$event) use (&$mailFilterEvent$translator, &$snippetSetId): void {
            $mailFilterEvent = $event;
            $snippetSetId = $translator->getSnippetSetId();
        };

        $this->getContainer()->get('event_dispatcher')->addListener(FlowSendMailActionEvent::class$function);

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

        $subscriber->handleFlow($flow);

        static::assertIsObject($mailFilterEvent);
        
Home | Imprint | This part of the site doesn't use cookies.