Documentation

ApkgExportService
in package

FinalYes

Orchestrates building an .apkg from one LWT language's terms.

Pulls the terms via the term repository, looks up tags through TermTagService, runs them through ApkgTermMapper, then hands the resulting notes to ApkgWriter. The writer is the only piece that knows the Anki binary layout; this service is just data assembly.

Table of Contents

Properties

$languages  : LanguageRepositoryInterface
$terms  : TermRepositoryInterface
$writer  : ApkgWriter

Methods

__construct()  : mixed
default()  : self
exportLanguage()  : ExportResult
Export every term in a language. Convenience wrapper around exportTerms().
exportTerms()  : ExportResult
Export a language's terms, optionally restricted to a specific subset.

Properties

Methods

exportLanguage()

Export every term in a language. Convenience wrapper around exportTerms().

public exportLanguage(int $languageId, string $outputPath) : ExportResult
Parameters
$languageId : int
$outputPath : string
Return values
ExportResult

exportTerms()

Export a language's terms, optionally restricted to a specific subset.

public exportTerms(int $languageId, array<int, int>|null $termIds, string $outputPath) : ExportResult

Subset semantics: any IDs not belonging to $languageId are silently skipped, so a stale browser-side selection won't leak terms across languages. Re-importing a subset .apkg only updates the terms whose guids it contains; LWT terms outside the subset are untouched, which matches what users want when they only studied a slice in Anki.

Parameters
$languageId : int
$termIds : array<int, int>|null

Subset to include; null = whole language

$outputPath : string
Return values
ExportResult
On this page

Search results