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
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
$created
private
DateTimeImmutable
$created
$description
private
string|null
$description
$enabled
private
bool
$enabled
$entryCount
private
int
$entryCount
$id
private
int|null
$id
$languageId
private
int
$languageId
$name
private
string
$name
$priority
private
int
$priority
$sourceFormat
private
string
$sourceFormat
$userId
private
int|null
$userId
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
Return values
selfcreated()
public
created() : DateTimeImmutable
Return values
DateTimeImmutabledescription()
public
description() : string|null
Return values
string|nulldisable()
Disable the dictionary for lookups.
public
disable() : void
enable()
Enable the dictionary for lookups.
public
enable() : void
entryCount()
public
entryCount() : int
Return values
intid()
public
id() : int|null
Return values
int|nullincrementEntryCount()
Increment the entry count.
public
incrementEntryCount([int $amount = 1 ]) : void
Parameters
- $amount : int = 1
-
Amount to add (default 1)
isEnabled()
public
isEnabled() : bool
Return values
boolisNew()
Check if this dictionary is new (not yet persisted).
public
isNew() : bool
Return values
boollanguageId()
public
languageId() : int
Return values
intname()
public
name() : string
Return values
stringpriority()
public
priority() : int
Return values
intrename()
Update the dictionary name.
public
rename(string $name) : void
Parameters
- $name : string
-
The new name
Tags
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
setPriority()
Set the lookup priority.
public
setPriority(int $priority) : void
Parameters
- $priority : int
-
Priority (1 = highest)
Tags
sourceFormat()
public
sourceFormat() : string
Return values
stringtoArray()
Export to array for JSON serialization.
public
toArray() : array<string, mixed>
Return values
array<string, mixed>userId()
public
userId() : int|null
Return values
int|null__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