loadLanguages example

return [
            LanguageEvents::LANGUAGE_DELETED_EVENT => 'invalidateCache',
            LanguageEvents::LANGUAGE_WRITTEN_EVENT => 'invalidateCache',
        ];
    }

    /** * @return LanguageData */
    public function loadLanguages(): array
    {
        return $this->cache->get(self::CACHE_KEY, fn () => $this->loader->loadLanguages());
    }

    public function invalidateCache(): void
    {
        $this->cache->delete(self::CACHE_KEY);
    }
}
// TODO: prefetch     /** * @param SyncOperation[] $operations * * @throw InvalidSyncOperationException */
    public function sync(array $operations, WriteContext $context): WriteResult
    {
        $commandQueue = new WriteCommandQueue();

        $context->setLanguages(
            $this->languageLoader->loadLanguages()
        );

        $writes = [];
        $notFound = [];
        $deletes = [];

        foreach ($operations as $operation) {
            if (!$operation instanceof SyncOperation) {
                continue;
            }

            

        $this->languages = [];
    }

    /** * @return LanguageData */
    private function getLanguages(): array
    {
        if (\count($this->languages) === 0) {
            $this->languages = $this->resolveParentLanguages(
                $this->languageLoader->loadLanguages()
            );
        }

        return $this->languages;
    }

    /** * resolves the inherited languages codes, so we have a guaranteed language code for each language id * we can't do it in the language loader as other places (e.g. DAL writes) expect that the translation code is unique * * @param LanguageData $languages * * @return LanguageData */
Home | Imprint | This part of the site doesn't use cookies.