Documentation

ApkgTermMapper
in package

FinalYes

Pure mapping between LWT Term entities and ApkgNote DTOs.

Kept free of database access so it can be exercised by unit tests without an integration fixture. The orchestrating services (ApkgExportService / ApkgImportService) handle persistence.

Status-to-suspended convention:

  • LWT 1..5 -> not suspended in Anki (active card)
  • LWT 98 -> suspended in Anki (ignored)
  • LWT 99 -> suspended in Anki (well-known; user already knows it)

On import, suspending a card in Anki is read as "user no longer wants this in their active rotation" -> status 98 (ignored). We deliberately do not promote to status 99 (well-known) on import, because suspension and "well-known" carry different semantics and we don't want to silently lose the distinction.

Table of Contents

Methods

applyNoteToTerm()  : TermChange
Apply round-tripped note data back onto a Term entity in place.
shouldSuspend()  : bool
Whether a status maps to a suspended Anki card.
termToNote()  : ApkgNote
Build an ApkgNote from a Term + its current tag list.
isLearningStatus()  : bool

Methods

applyNoteToTerm()

Apply round-tripped note data back onto a Term entity in place.

public static applyNoteToTerm(Term $term, ApkgNote $note) : TermChange

Returns a record of which fields changed so the caller can produce useful import summary stats.

Parameters
$term : Term
$note : ApkgNote
Return values
TermChange

shouldSuspend()

Whether a status maps to a suspended Anki card.

public static shouldSuspend(TermStatus $status) : bool
Parameters
$status : TermStatus
Return values
bool

termToNote()

Build an ApkgNote from a Term + its current tag list.

public static termToNote(Term $term, array<int, string> $tagNames) : ApkgNote
Parameters
$term : Term
$tagNames : array<int, string>
Return values
ApkgNote
On this page

Search results