NumberingService
in package
Numbering Service for GLAM/DAM Sectors
Generates unique identifiers based on configurable patterns per sector.
Supported Tokens:
- {SEQ:n} Sequential number, n digits zero-padded
- {YEAR} Current year (4 digit)
- {YY} Current year (2 digit)
- {MONTH} Current month (2 digit)
- {DAY} Current day (2 digit)
- {PREFIX} Configured prefix for sector
- {REPO} Repository code
- {FONDS} Parent fonds code
- {SERIES} Parent series code
- {COLLECTION} Collection identifier
- {DEPT} Department code
- {TYPE} Material/media type
- {UUID} Short UUID (8 chars)
- {RANDOM:n} Random alphanumeric, n chars
- {ITEM} Item number within lot
- {PROJECT} Project code
Tags
Table of Contents
Methods
- createScheme() : int
- Create a new scheme.
- deleteScheme() : void
- Delete a scheme.
- generateForNewRecord() : string|null
- Generate and reserve identifier for new record.
- getAllSchemes() : array<string|int, mixed>
- Get all schemes.
- getAvailableTokens() : array<string|int, mixed>
- Get available tokens with descriptions.
- getInstance() : self
- getNextReference() : string
- Get next reference for a sector.
- getNumberingInfo() : array<string|int, mixed>
- Get numbering info for a sector (for forms).
- getSchemeById() : object|null
- Get scheme by ID.
- getSchemesForSector() : array<string|int, mixed>
- Get all schemes for a sector.
- getSectorFromDisplayStandard() : string|null
- Map display standard to sector code.
- getSectorPrefixes() : array<string|int, mixed>
- Get sector prefixes.
- isAutoGenerateEnabled() : bool
- Check if auto-generation is enabled for a sector.
- isDuplicate() : bool
- Check if a reference already exists.
- isManualOverrideAllowed() : bool
- Check if manual override is allowed for a sector.
- linkReferenceToObject() : void
- Link a reference to an object after creation.
- previewMultiple() : array<string|int, mixed>
- Preview multiple references for UI display.
- previewNextReference() : string
- Preview next reference without consuming sequence.
- releaseReference() : void
- Release a reference (for fill_gaps feature).
- reserveReference() : void
- Reserve a reference when creating a record.
- resetSequence() : void
- Reset sequence for a scheme.
- setAsDefault() : void
- Set a scheme as default for its sector.
- updateScheme() : void
- Update a scheme.
- validateReference() : array<string|int, mixed>
- Validate a manual reference against the scheme.
Methods
createScheme()
Create a new scheme.
public
createScheme(array<string|int, mixed> $data) : int
Parameters
- $data : array<string|int, mixed>
Return values
intdeleteScheme()
Delete a scheme.
public
deleteScheme(int $id) : void
Parameters
- $id : int
generateForNewRecord()
Generate and reserve identifier for new record.
public
generateForNewRecord(string $sector[, array<string|int, mixed> $context = [] ][, int|null $repositoryId = null ]) : string|null
Call this when saving a new record.
Parameters
- $sector : string
- $context : array<string|int, mixed> = []
- $repositoryId : int|null = null
Return values
string|nullgetAllSchemes()
Get all schemes.
public
getAllSchemes() : array<string|int, mixed>
Return values
array<string|int, mixed>getAvailableTokens()
Get available tokens with descriptions.
public
getAvailableTokens() : array<string|int, mixed>
Return values
array<string|int, mixed>getInstance()
public
static getInstance() : self
Return values
selfgetNextReference()
Get next reference for a sector.
public
getNextReference(string $sector[, array<string|int, mixed> $context = [] ][, int|null $repositoryId = null ]) : string
Parameters
- $sector : string
-
Sector code (archive, library, museum, gallery, dam)
- $context : array<string|int, mixed> = []
-
Additional context for token replacement
- $repositoryId : int|null = null
-
Optional repository for scheme override
Return values
string —Generated reference
getNumberingInfo()
Get numbering info for a sector (for forms).
public
getNumberingInfo(string $sector[, array<string|int, mixed> $context = [] ][, int|null $repositoryId = null ]) : array<string|int, mixed>
Parameters
- $sector : string
- $context : array<string|int, mixed> = []
- $repositoryId : int|null = null
Return values
array<string|int, mixed>getSchemeById()
Get scheme by ID.
public
getSchemeById(int $id) : object|null
Parameters
- $id : int
Return values
object|nullgetSchemesForSector()
Get all schemes for a sector.
public
getSchemesForSector(string $sector) : array<string|int, mixed>
Parameters
- $sector : string
Return values
array<string|int, mixed>getSectorFromDisplayStandard()
Map display standard to sector code.
public
getSectorFromDisplayStandard(int|null $displayStandardId) : string|null
Parameters
- $displayStandardId : int|null
Return values
string|nullgetSectorPrefixes()
Get sector prefixes.
public
getSectorPrefixes() : array<string|int, mixed>
Return values
array<string|int, mixed>isAutoGenerateEnabled()
Check if auto-generation is enabled for a sector.
public
isAutoGenerateEnabled(string $sector[, int|null $repositoryId = null ]) : bool
Parameters
- $sector : string
- $repositoryId : int|null = null
Return values
boolisDuplicate()
Check if a reference already exists.
public
isDuplicate(string $reference[, int|null $excludeId = null ]) : bool
Parameters
- $reference : string
-
The identifier to check
- $excludeId : int|null = null
-
Object ID to exclude (for edit scenarios)
Return values
boolisManualOverrideAllowed()
Check if manual override is allowed for a sector.
public
isManualOverrideAllowed(string $sector[, int|null $repositoryId = null ]) : bool
Parameters
- $sector : string
- $repositoryId : int|null = null
Return values
boollinkReferenceToObject()
Link a reference to an object after creation.
public
linkReferenceToObject(string $reference, int $objectId[, string $objectType = 'information_object' ]) : void
Parameters
- $reference : string
- $objectId : int
- $objectType : string = 'information_object'
previewMultiple()
Preview multiple references for UI display.
public
previewMultiple(string $sector[, int $count = 3 ][, array<string|int, mixed> $context = [] ]) : array<string|int, mixed>
Parameters
- $sector : string
- $count : int = 3
- $context : array<string|int, mixed> = []
Return values
array<string|int, mixed>previewNextReference()
Preview next reference without consuming sequence.
public
previewNextReference(string $sector[, array<string|int, mixed> $context = [] ][, int|null $repositoryId = null ]) : string
Parameters
- $sector : string
- $context : array<string|int, mixed> = []
- $repositoryId : int|null = null
Return values
stringreleaseReference()
Release a reference (for fill_gaps feature).
public
releaseReference(string $reference) : void
Parameters
- $reference : string
reserveReference()
Reserve a reference when creating a record.
public
reserveReference(int $schemeId, int $sequenceNumber, string $reference[, int|null $objectId = null ]) : void
Parameters
- $schemeId : int
- $sequenceNumber : int
- $reference : string
- $objectId : int|null = null
resetSequence()
Reset sequence for a scheme.
public
resetSequence(int $schemeId[, int $newValue = 0 ]) : void
Parameters
- $schemeId : int
- $newValue : int = 0
setAsDefault()
Set a scheme as default for its sector.
public
setAsDefault(int $id) : void
Parameters
- $id : int
updateScheme()
Update a scheme.
public
updateScheme(int $id, array<string|int, mixed> $data) : void
Parameters
- $id : int
- $data : array<string|int, mixed>
validateReference()
Validate a manual reference against the scheme.
public
validateReference(string $reference, string $sector[, int|null $excludeId = null ][, int|null $repositoryId = null ]) : array<string|int, mixed>
Parameters
- $reference : string
-
The identifier to validate
- $sector : string
-
Sector code
- $excludeId : int|null = null
-
Object ID to exclude from duplicate check (for edits)
- $repositoryId : int|null = null
-
Repository ID for scheme lookup