ApkgImportService
in package
FinalYes
Reads an .apkg and merges field/tag/suspension changes back into LWT terms.
Merge policy (v1, deliberately conservative):
- Notes whose guid matches an existing LWT term update that term's translation/romanization/notes; tags become whatever the user had in Anki; suspended cards demote learning-status terms to status 98.
- Notes referencing an LWT term that no longer exists are counted as "skipped_missing" — never recreated, since we'd lose the language link.
- Notes from outside LWT (no
lwt-guid prefix and no LwtId field) are counted as "skipped_unknown" — silently ignored. A future iteration will surface these for create-as-new with a language picker. - SRS scheduling state is intentionally not consumed.
Table of Contents
Properties
Methods
- __construct() : mixed
- default() : self
- importApkg() : ImportResult
- sameTagSet() : bool
Properties
$reader read-only
private
ApkgReader
$reader
$terms read-only
private
TermRepositoryInterface
$terms
Methods
__construct()
public
__construct(TermRepositoryInterface $terms, ApkgReader $reader) : mixed
Parameters
- $terms : TermRepositoryInterface
- $reader : ApkgReader
default()
public
static default() : self
Return values
selfimportApkg()
public
importApkg(string $apkgPath) : ImportResult
Parameters
- $apkgPath : string
Return values
ImportResultsameTagSet()
private
sameTagSet(array<int, string> $a, array<int, string> $b) : bool
Parameters
- $a : array<int, string>
- $b : array<int, string>