Documentation

LocalDictionary
in package

A local dictionary represented as a domain object.

Local dictionaries store imported dictionary data for offline lookups. They are associated with a language and can have multiple entries.

Tags
since
3.0.0

Table of Contents

Properties

$created  : DateTimeImmutable
$description  : string|null
$enabled  : bool
$entryCount  : int
$id  : int|null
$languageId  : int
$name  : string
$priority  : int
$sourceFormat  : string
$userId  : int|null

Methods

create()  : self
Create a new local dictionary.
created()  : DateTimeImmutable
description()  : string|null
disable()  : void
Disable the dictionary for lookups.
enable()  : void
Enable the dictionary for lookups.
entryCount()  : int
id()  : int|null
incrementEntryCount()  : void
Increment the entry count.
isEnabled()  : bool
isNew()  : bool
Check if this dictionary is new (not yet persisted).
languageId()  : int
name()  : string
priority()  : int
rename()  : void
Update the dictionary name.
setDescription()  : void
Set the description.
setEntryCount()  : void
Update the entry count.
setPriority()  : void
Set the lookup priority.
sourceFormat()  : string
toArray()  : array<string, mixed>
Export to array for JSON serialization.
userId()  : int|null
__construct()  : mixed
Private constructor - use factory methods instead.

Properties

Methods

create()

Create a new local dictionary.

public static create(int $languageId, string $name[, string $sourceFormat = 'csv' ][, int|null $userId = null ]) : self
Parameters
$languageId : int

Language ID this dictionary belongs to

$name : string

Dictionary name

$sourceFormat : string = 'csv'

Source format (csv, json, stardict)

$userId : int|null = null

User ID for multi-user mode

Tags
throws
InvalidArgumentException

If name is empty or format is invalid

Return values
self

created()

public created() : DateTimeImmutable
Return values
DateTimeImmutable

description()

public description() : string|null
Return values
string|null

disable()

Disable the dictionary for lookups.

public disable() : void

incrementEntryCount()

Increment the entry count.

public incrementEntryCount([int $amount = 1 ]) : void
Parameters
$amount : int = 1

Amount to add (default 1)

isNew()

Check if this dictionary is new (not yet persisted).

public isNew() : bool
Return values
bool

rename()

Update the dictionary name.

public rename(string $name) : void
Parameters
$name : string

The new name

Tags
throws
InvalidArgumentException

If name is empty

setDescription()

Set the description.

public setDescription(string|null $description) : void
Parameters
$description : string|null

Description text

setEntryCount()

Update the entry count.

public setEntryCount(int $count) : void
Parameters
$count : int

Number of entries

Tags
throws
InvalidArgumentException

If count is negative

setPriority()

Set the lookup priority.

public setPriority(int $priority) : void
Parameters
$priority : int

Priority (1 = highest)

Tags
throws
InvalidArgumentException

If priority is invalid

toArray()

Export to array for JSON serialization.

public toArray() : array<string, mixed>
Return values
array<string, mixed>

__construct()

Private constructor - use factory methods instead.

private __construct(int|null $id, int $languageId, string $name, string|null $description, string $sourceFormat, int $entryCount, int $priority, bool $enabled, DateTimeImmutable $created, int|null $userId) : mixed
Parameters
$id : int|null
$languageId : int
$name : string
$description : string|null
$sourceFormat : string
$entryCount : int
$priority : int
$enabled : bool
$created : DateTimeImmutable
$userId : int|null

        
On this page

Search results