MultiWordService
in package
Service for managing multi-word expressions.
Handles:
- Creating multi-word terms
- Updating multi-word terms
- Retrieving multi-word data
- Deleting multi-word expressions
- Finding multi-word by text
Tags
Table of Contents
Properties
Methods
- __construct() : mixed
- Constructor.
- createMultiWord() : array{id: int, message: string}
- Create a new multi-word expression.
- deleteMultiWord() : int
- Delete a multi-word expression.
- findMultiWordByText() : int|null
- Find multi-word by text and language.
- getMultiWordData() : array{text: string, lgid: int, translation: string, sentence: string, notes: string, romanization: string, status: int}|null
- Get multi-word data for editing.
- updateMultiWord() : array{id: int, message: string, status: int}
- Update an existing multi-word expression.
Properties
$expressionService
private
ExpressionService
$expressionService
Methods
__construct()
Constructor.
public
__construct([ExpressionService|null $expressionService = null ]) : mixed
Parameters
- $expressionService : ExpressionService|null = null
-
Expression service
createMultiWord()
Create a new multi-word expression.
public
createMultiWord(array<string, mixed> $data) : array{id: int, message: string}
Parameters
- $data : array<string, mixed>
-
Multi-word data:
- lgid: Language ID
- textlc: Lowercase text
- text: Original text
- status: Word status
- translation: Translation text
- sentence: Example sentence
- notes: Personal notes
- roman: Romanization/phonetic
- wordcount: Number of words in expression
Return values
array{id: int, message: string}deleteMultiWord()
Delete a multi-word expression.
public
deleteMultiWord(int $wordId) : int
Deletes the word and its associated text items with word count > 1.
Parameters
- $wordId : int
-
Word ID to delete
Return values
int —Number of affected rows
findMultiWordByText()
Find multi-word by text and language.
public
findMultiWordByText(string $textlc, int $langId) : int|null
Parameters
- $textlc : string
-
Lowercase text
- $langId : int
-
Language ID
Return values
int|null —Word ID or null if not found
getMultiWordData()
Get multi-word data for editing.
public
getMultiWordData(int $wordId) : array{text: string, lgid: int, translation: string, sentence: string, notes: string, romanization: string, status: int}|null
Parameters
- $wordId : int
-
Word ID
Return values
array{text: string, lgid: int, translation: string, sentence: string, notes: string, romanization: string, status: int}|null —Multi-word data or null if not found
updateMultiWord()
Update an existing multi-word expression.
public
updateMultiWord(int $wordId, array<string|int, mixed> $data, int $oldStatus, int $newStatus) : array{id: int, message: string, status: int}
Parameters
- $wordId : int
-
Word ID
- $data : array<string|int, mixed>
-
Multi-word data (same keys as createMultiWord)
- $oldStatus : int
-
Previous status for comparison
- $newStatus : int
-
New status to set