LanguageRepositoryInterface
in
Repository interface for Language entity.
Defines the contract for language persistence operations. Implementations may use different storage backends (MySQL, memory, etc.)
Tags
Table of Contents
Methods
- createEmpty() : Language
- Create a new empty language entity with default values.
- delete() : void
- Delete a language by ID.
- exists() : bool
- Check if a language exists.
- find() : Language|null
- Find a language by its ID.
- findAllActive() : array<string|int, Language>
- Find all non-empty languages (those with a name).
- findByName() : Language|null
- Find a language by name.
- findEmptyLanguageId() : int|null
- Find the first empty language record (for reuse on insert).
- getAllAsDict() : array<string, int>
- Get languages as name => id dictionary.
- getForSelect() : array<int, array{id: int, name: string}>
- Get languages formatted for select dropdown options.
- getName() : string|null
- Get the name of a language by ID.
- getTranslatorUri() : string|null
- Get the translator URI for a language.
- getWordCharacters() : string|null
- Get the word character regex for a language.
- isRightToLeft() : bool
- Check if a language is RTL (right-to-left).
- nameExists() : bool
- Check if a language name exists.
- save() : void
- Save a language entity (create or update).
Methods
createEmpty()
Create a new empty language entity with default values.
public
createEmpty() : Language
Return values
Languagedelete()
Delete a language by ID.
public
delete(int $id) : void
Parameters
- $id : int
-
Language ID
exists()
Check if a language exists.
public
exists(int $id) : bool
Parameters
- $id : int
-
Language ID
Return values
boolfind()
Find a language by its ID.
public
find(int $id) : Language|null
Parameters
- $id : int
-
Language ID
Return values
Language|null —Language entity or null if not found
findAllActive()
Find all non-empty languages (those with a name).
public
findAllActive([string $orderBy = 'LgName' ][, string $direction = 'ASC' ]) : array<string|int, Language>
Parameters
- $orderBy : string = 'LgName'
-
Column to order by (default: name)
- $direction : string = 'ASC'
-
Sort direction (default: ASC)
Return values
array<string|int, Language>findByName()
Find a language by name.
public
findByName(string $name) : Language|null
Parameters
- $name : string
-
Language name
Return values
Language|nullfindEmptyLanguageId()
Find the first empty language record (for reuse on insert).
public
findEmptyLanguageId() : int|null
Return values
int|null —The empty language ID or null
getAllAsDict()
Get languages as name => id dictionary.
public
getAllAsDict() : array<string, int>
Return values
array<string, int>getForSelect()
Get languages formatted for select dropdown options.
public
getForSelect([int $maxNameLength = 30 ]) : array<int, array{id: int, name: string}>
Parameters
- $maxNameLength : int = 30
-
Maximum name length before truncation
Return values
array<int, array{id: int, name: string}>getName()
Get the name of a language by ID.
public
getName(int $id) : string|null
Parameters
- $id : int
-
Language ID
Return values
string|null —The language name or null if not found
getTranslatorUri()
Get the translator URI for a language.
public
getTranslatorUri(int $id) : string|null
Parameters
- $id : int
-
Language ID
Return values
string|null —The translator URI or null if not found
getWordCharacters()
Get the word character regex for a language.
public
getWordCharacters(int $id) : string|null
Parameters
- $id : int
-
Language ID
Return values
string|null —The regex or null if not found
isRightToLeft()
Check if a language is RTL (right-to-left).
public
isRightToLeft(int $id) : bool
Parameters
- $id : int
-
Language ID
Return values
boolnameExists()
Check if a language name exists.
public
nameExists(string $name[, int|null $excludeId = null ]) : bool
Parameters
- $name : string
-
Language name
- $excludeId : int|null = null
-
Language ID to exclude (for updates)
Return values
boolsave()
Save a language entity (create or update).
public
save(Language $entity) : void
Parameters
- $entity : Language
-
The language to save