From 5469ce7fec85b7636f61a0563f656462f1b249d8 Mon Sep 17 00:00:00 2001 From: Dendy Faist Date: Sun, 28 Sep 2025 10:03:33 +0200 Subject: [PATCH] fix: Fix kanji card creation --- src/Command/CreateProductionCommand.php | 3 ++- src/Entity/SentenceListeningNote.php | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Command/CreateProductionCommand.php b/src/Command/CreateProductionCommand.php index de3919f..b8f6747 100644 --- a/src/Command/CreateProductionCommand.php +++ b/src/Command/CreateProductionCommand.php @@ -84,7 +84,8 @@ class CreateProductionCommand extends Command $sNote = $this->ankiService->getNote($noteIds[array_key_last($noteIds)]); $newSlNote = SentenceListeningNote::fromNote($sNote, $term); - if (!$this->ankiService->addNote($newSlNote, SentenceListeningNote::DECK)) { + dd($newSlNote); + if (!$this->ankiService->addNote($newSlNote)) { throw new \Exception('Failed to add note!'); } } diff --git a/src/Entity/SentenceListeningNote.php b/src/Entity/SentenceListeningNote.php index 509fa34..e90f2df 100644 --- a/src/Entity/SentenceListeningNote.php +++ b/src/Entity/SentenceListeningNote.php @@ -18,9 +18,10 @@ class SentenceListeningNote extends Note } public function setTerm(Term $term): static { - $this->fields['Vocab'] = $term->getKanji(); - $this->fields['VocabDef'] = $term->toAnkiVocabDef(); - $this->fields['SentKanji'] = $this->stringHighlight( + $this->fields['VocabKanji'] = $term->getKanji(); + $this->fields['VocabFurigana'] = $term->getReading(); + $this->fields['VocabDef'] = $term->toAnkiVocabDef(); + $this->fields['SentKanji'] = $this->stringHighlight( $this->fields['SentKanji'], $term->getKanji(), ); @@ -50,9 +51,9 @@ class SentenceListeningNote extends Note return $note; } - public static function fromNote(Note $origNote, Term $term): static + public static function fromNote(Note $origNote, Term $term): self { - $slNote = new static(); + $slNote = new self(); foreach (get_object_vars($origNote) as $prop => $value) { $slNote->$prop = $value; }