UpdateTerm
in package
Use case for updating an existing term.
Tags
Table of Contents
Properties
Methods
- __construct() : mixed
- Constructor.
- execute() : Term
- Execute the update term use case.
- executeFromArray() : array{id: int, message: string, success: bool}
- Execute and return result array (backward compatible with WordService).
- normalizeTranslation() : string
- Normalize translation text.
- replaceTabNewline() : string
- Replace tabs and newlines in text.
Properties
$repository
private
TermRepositoryInterface
$repository
Methods
__construct()
Constructor.
public
__construct(TermRepositoryInterface $repository) : mixed
Parameters
- $repository : TermRepositoryInterface
-
Term repository
execute()
Execute the update term use case.
public
execute(int $termId[, int|null $status = null ][, string|null $translation = null ][, string|null $sentence = null ][, string|null $notes = null ][, string|null $romanization = null ]) : Term
Parameters
- $termId : int
-
Term ID to update
- $status : int|null = null
-
New status (null to keep current)
- $translation : string|null = null
-
New translation (null to keep current)
- $sentence : string|null = null
-
New sentence (null to keep current)
- $notes : string|null = null
-
New notes (null to keep current)
- $romanization : string|null = null
-
New romanization (null to keep current)
Tags
Return values
Term —The updated term entity
executeFromArray()
Execute and return result array (backward compatible with WordService).
public
executeFromArray(array<string|int, mixed> $data) : array{id: int, message: string, success: bool}
Parameters
- $data : array<string|int, mixed>
-
Update data array with keys like WoID, WoStatus, etc.
Return values
array{id: int, message: string, success: bool}normalizeTranslation()
Normalize translation text.
private
normalizeTranslation(string $translation) : string
Parameters
- $translation : string
-
Raw translation
Return values
string —Normalized translation
replaceTabNewline()
Replace tabs and newlines in text.
private
replaceTabNewline(string $text) : string
Parameters
- $text : string
-
Input text
Return values
string —Cleaned text