Documentation

UpdateTerm

Use case for updating an existing term.

Tags
since
3.0.0

Table of Contents

Properties

$repository  : TermRepositoryInterface

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

Methods

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
throws
InvalidArgumentException

If term not found

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


        
On this page

Search results