Documentation

TermRepositoryInterface

Repository interface for Term entities.

Defines the contract for vocabulary/word management operations.

Tags
since
3.0.0

Table of Contents

Methods

count()  : int
Count terms matching criteria.
countByLanguage()  : int
Count terms for a specific language.
delete()  : bool
Delete a term by ID.
deleteMultiple()  : int
Delete multiple terms by IDs.
exists()  : bool
Check if a term exists.
find()  : Term|null
Find a term by ID.
findAll()  : array<string|int, Term>
Find all terms.
findByLanguage()  : array<string|int, Term>
Find all terms for a specific language.
findByLemma()  : array<string|int, Term>
Find all terms sharing a lemma in a language (word family).
findByStatus()  : array<string|int, Term>
Find terms by status.
findByTextLc()  : Term|null
Find a term by lowercase text within a language.
findForReview()  : array<string|int, Term>
Find terms needing review (based on score thresholds).
findIgnored()  : array<string|int, Term>
Find ignored terms (status 98).
findKnown()  : array<string|int, Term>
Find terms that are known (status 5 or 99).
findLearning()  : array<string|int, Term>
Find terms in learning stages (status 1-4).
findMultiWord()  : array<string|int, Term>
Find multi-word expressions (word count > 1).
findPaginated()  : Term[], total: int, page: int, per_page: int, total_pages: int}
Get terms with pagination.
findRecent()  : array<string|int, Term>
Find recently added terms.
getStatistics()  : array{total: int, learning: int, known: int, ignored: int, multi_word: int}
Get statistics for terms.
save()  : int
Save a term (insert or update).
searchByText()  : array<string|int, Term>
Search terms by text.
termExists()  : bool
Check if a term exists within a language.
updateLemma()  : bool
Update the lemma (base form) of a term.
updateRomanization()  : bool
Update the romanization of a term.
updateStatus()  : bool
Update the status of a term.
updateStatusMultiple()  : int
Update status for multiple terms.
updateTranslation()  : bool
Update the translation of a term.

Methods

count()

Count terms matching criteria.

public count([array<string, mixed> $criteria = [] ]) : int
Parameters
$criteria : array<string, mixed> = []

Field => value pairs

Return values
int

The count

countByLanguage()

Count terms for a specific language.

public countByLanguage(int $languageId) : int
Parameters
$languageId : int

Language ID

Return values
int

delete()

Delete a term by ID.

public delete(int $id) : bool
Parameters
$id : int

Term ID

Return values
bool

True if deleted

deleteMultiple()

Delete multiple terms by IDs.

public deleteMultiple(array<string|int, int> $termIds) : int
Parameters
$termIds : array<string|int, int>

Array of term IDs

Return values
int

Number of deleted terms

exists()

Check if a term exists.

public exists(int $id) : bool
Parameters
$id : int

Term ID

Return values
bool

findByLanguage()

Find all terms for a specific language.

public findByLanguage(int $languageId[, string|null $orderBy = 'WoText' ][, string $direction = 'ASC' ]) : array<string|int, Term>
Parameters
$languageId : int

Language ID

$orderBy : string|null = 'WoText'

Column to order by

$direction : string = 'ASC'

Sort direction

Return values
array<string|int, Term>

findByLemma()

Find all terms sharing a lemma in a language (word family).

public findByLemma(int $languageId, string $lemmaLc) : array<string|int, Term>
Parameters
$languageId : int

Language ID

$lemmaLc : string

Lowercase lemma

Return values
array<string|int, Term>

findByStatus()

Find terms by status.

public findByStatus(int $status[, int|null $languageId = null ]) : array<string|int, Term>
Parameters
$status : int

Status value (1-5, 98, 99)

$languageId : int|null = null

Language ID (null for all)

Return values
array<string|int, Term>

findByTextLc()

Find a term by lowercase text within a language.

public findByTextLc(int $languageId, string $textLc) : Term|null
Parameters
$languageId : int

Language ID

$textLc : string

Lowercase term text

Return values
Term|null

findForReview()

Find terms needing review (based on score thresholds).

public findForReview([int|null $languageId = null ][, float $scoreThreshold = 0.0 ][, int $limit = 100 ]) : array<string|int, Term>
Parameters
$languageId : int|null = null

Language ID (null for all)

$scoreThreshold : float = 0.0

Score threshold for today

$limit : int = 100

Maximum results

Return values
array<string|int, Term>

findIgnored()

Find ignored terms (status 98).

public findIgnored([int|null $languageId = null ]) : array<string|int, Term>
Parameters
$languageId : int|null = null

Language ID (null for all)

Return values
array<string|int, Term>

findKnown()

Find terms that are known (status 5 or 99).

public findKnown([int|null $languageId = null ]) : array<string|int, Term>
Parameters
$languageId : int|null = null

Language ID (null for all)

Return values
array<string|int, Term>

findLearning()

Find terms in learning stages (status 1-4).

public findLearning([int|null $languageId = null ]) : array<string|int, Term>
Parameters
$languageId : int|null = null

Language ID (null for all)

Return values
array<string|int, Term>

findMultiWord()

Find multi-word expressions (word count > 1).

public findMultiWord([int|null $languageId = null ]) : array<string|int, Term>
Parameters
$languageId : int|null = null

Language ID (null for all)

Return values
array<string|int, Term>

findPaginated()

Get terms with pagination.

public findPaginated([int $languageId = 0 ][, int $page = 1 ][, int $perPage = 20 ][, string $orderBy = 'WoText' ][, string $direction = 'ASC' ]) : Term[], total: int, page: int, per_page: int, total_pages: int}
Parameters
$languageId : int = 0

Language ID (0 for all)

$page : int = 1

Page number (1-based)

$perPage : int = 20

Items per page

$orderBy : string = 'WoText'

Column to order by

$direction : string = 'ASC'

Sort direction

Return values
Term[], total: int, page: int, per_page: int, total_pages: int}

findRecent()

Find recently added terms.

public findRecent([int|null $languageId = null ][, int $limit = 50 ]) : array<string|int, Term>
Parameters
$languageId : int|null = null

Language ID (null for all)

$limit : int = 50

Maximum results

Return values
array<string|int, Term>

getStatistics()

Get statistics for terms.

public getStatistics([int|null $languageId = null ]) : array{total: int, learning: int, known: int, ignored: int, multi_word: int}
Parameters
$languageId : int|null = null

Language ID (null for all)

Return values
array{total: int, learning: int, known: int, ignored: int, multi_word: int}

save()

Save a term (insert or update).

public save(Term $term) : int
Parameters
$term : Term

The term to save

Return values
int

The term ID

searchByText()

Search terms by text.

public searchByText(string $query[, int|null $languageId = null ][, int $limit = 50 ]) : array<string|int, Term>
Parameters
$query : string

Search query

$languageId : int|null = null

Language ID (null for all)

$limit : int = 50

Maximum results

Return values
array<string|int, Term>

termExists()

Check if a term exists within a language.

public termExists(int $languageId, string $textLc[, int|null $excludeId = null ]) : bool
Parameters
$languageId : int

Language ID

$textLc : string

Lowercase term text

$excludeId : int|null = null

Term ID to exclude (for updates)

Return values
bool

updateLemma()

Update the lemma (base form) of a term.

public updateLemma(int $termId, string|null $lemma) : bool
Parameters
$termId : int

Term ID

$lemma : string|null

New lemma (null to clear)

Return values
bool

True if updated

updateRomanization()

Update the romanization of a term.

public updateRomanization(int $termId, string $romanization) : bool
Parameters
$termId : int

Term ID

$romanization : string

New romanization

Return values
bool

True if updated

updateStatus()

Update the status of a term.

public updateStatus(int $termId, int $status) : bool
Parameters
$termId : int

Term ID

$status : int

New status value

Return values
bool

True if updated

updateStatusMultiple()

Update status for multiple terms.

public updateStatusMultiple(array<string|int, int> $termIds, int $status) : int
Parameters
$termIds : array<string|int, int>

Array of term IDs

$status : int

New status value

Return values
int

Number of updated terms

updateTranslation()

Update the translation of a term.

public updateTranslation(int $termId, string $translation) : bool
Parameters
$termId : int

Term ID

$translation : string

New translation

Return values
bool

True if updated


        
On this page

Search results