MemberIdentity
Reference for the MemberIdentity module: register the identity detail and document types an application needs, and store a member's identity records, postal addresses, detail values and verification documents. Records follow an immutable pattern, so each change inserts a new row and the latest one is read back.
This page is a pure reference. For how the framework fits together, see the Guide.
MemberIdentityConfig- register in code the detail and document types a module needs.MemberIdentityAddressData- immutable data for a member's postal address.MemberIdentityAddressDatabase- read and save member addresses.MemberIdentityData- immutable data for a member identity record.MemberIdentityDatabase- read and save member identity records.MemberIdentityDetailTypeData- immutable data for a stored detail type.MemberIdentityDetailTypeDatabase- read stored detail types.MemberIdentityDetailValueData- immutable data for a member's detail value.MemberIdentityDetailValueDatabase- read and save member detail values.MemberIdentityDocumentData- immutable data for a stored identity document.MemberIdentityDocumentDatabase- read and update identity documents.MemberIdentityDocumentQueue- queue processing that raises a support ticket for a document.MemberIdentityDocumentTicketQueueDatabase- lock and process driver documents that need a support ticket.MemberIdentityDocumentTypeData- immutable data for a registered document type.
MemberIdentityConfig
Register the identity detail types and document types a module needs. Detail types and document types are configured in code, like settings, rather than stored in a database table. Reads are filtered by module name.
DetailType
MemberIdentityConfig::DetailType(string $moduleName, string $typeName, string $label, string $inputType, string $default): void
Register a detail type for a module.
| Name | Type | Description |
|---|---|---|
$moduleName | string | Module name, for example FrenziDriver. |
$typeName | string | Type name, for example firstName. |
$label | string | Display label, for example First Name. |
$inputType | string | Input type, for example text, date or textarea. |
$default | string | Default value. |
Returns void
DocumentType
MemberIdentityConfig::DocumentType(string $moduleName, string $documentTypeName, string $label): void
Register a document type for a module.
| Name | Type | Description |
|---|---|---|
$moduleName | string | Module name, for example FrenziMember. |
$documentTypeName | string | Document type identifier, for example passport. |
$label | string | Display label, for example Passport. |
Returns void
GetDetailDefault
MemberIdentityConfig::GetDetailDefault(string $moduleName, string $typeName): string
Get the default value for a detail type, or an empty string when it is not registered.
| Name | Type | Description |
|---|---|---|
$moduleName | string | The module that registered the type. |
$typeName | string | The detail type name. |
Returns string The default value, or an empty string.
GetDetailTypes
MemberIdentityConfig::GetDetailTypes(string $moduleName): array
Get all detail types registered for a module.
| Name | Type | Description |
|---|---|---|
$moduleName | string | The module to read detail types for. |
Returns array A list of detail type objects.
GetDocumentType
MemberIdentityConfig::GetDocumentType(string $moduleName, string $documentTypeName): MemberIdentityDocumentTypeData
Get a registered document type by module name and document type name. Throws when it is not registered.
| Name | Type | Description |
|---|---|---|
$moduleName | string | The module that registered the type. |
$documentTypeName | string | The document type name. |
Returns MemberIdentityDocumentTypeData The registered document type.
GetDocumentTypes
MemberIdentityConfig::GetDocumentTypes(): array
Get all registered document types across every module.
Returns array A list of MemberIdentityDocumentTypeData.
GetDocumentTypesByModule
MemberIdentityConfig::GetDocumentTypesByModule(string $moduleName): array
Get all document types registered for a module.
| Name | Type | Description |
|---|---|---|
$moduleName | string | The module to read document types for. |
Returns array A list of MemberIdentityDocumentTypeData.
HasDocumentType
MemberIdentityConfig::HasDocumentType(string $moduleName, string $documentTypeName): bool
Check whether a document type is registered.
| Name | Type | Description |
|---|---|---|
$moduleName | string | The module that registered the type. |
$documentTypeName | string | The document type name. |
Returns bool True when the document type is registered.
MemberIdentityAddressData
Immutable data for a member's postal address, linking a member to a Location address record with the time it was added.
Properties
| Name | Type | Description |
|---|---|---|
$id | int | The address record id. |
$memberId | int | The member the address belongs to. |
$locationAddressId | int | The Location address record id. |
$addedTimestamp | CalendarDateTimeData | When the address was added. |
__construct
new MemberIdentityAddressData(int $id = 0, int $memberId = 0, int $locationAddressId = 0, CalendarDateTimeData $addedTimestamp = new CalendarDateTimeData())
Create a member address data object.
MemberIdentityAddressDatabase
Read and save member postal addresses. Saving follows an immutable pattern, always inserting a new row, so the latest address is the most recent by id.
fromRow
MemberIdentityAddressDatabase::fromRow(stdClass $row): MemberIdentityAddressData
Convert a single database row to a MemberIdentityAddressData object.
| Name | Type | Description |
|---|---|---|
$row | stdClass | A database row. |
Returns MemberIdentityAddressData The address data.
GetById
MemberIdentityAddressDatabase::GetById(int $addressId): MemberIdentityAddressData
Get an address by its id.
| Name | Type | Description |
|---|---|---|
$addressId | int | The address record id. |
Returns MemberIdentityAddressData The address data.
GetByMemberId
MemberIdentityAddressDatabase::GetByMemberId(int $memberId): array
Get all addresses for a member, most recent first.
| Name | Type | Description |
|---|---|---|
$memberId | int | The member id. |
Returns array A list of MemberIdentityAddressData.
GetLatestByMemberId
MemberIdentityAddressDatabase::GetLatestByMemberId(int $memberId): MemberIdentityAddressData|null
Get the latest address for a member, or null when there is none.
| Name | Type | Description |
|---|---|---|
$memberId | int | The member id. |
Returns MemberIdentityAddressData|null The latest address, or null.
Save
MemberIdentityAddressDatabase::Save(int $memberId, int $locationAddressId): int
Save a new address, always inserting a new row.
| Name | Type | Description |
|---|---|---|
$memberId | int | The member id. |
$locationAddressId | int | The Location address record id. |
Returns int The new address id.
MemberIdentityData
Immutable data for a member identity record, holding the member it belongs to and the time it was added.
Properties
| Name | Type | Description |
|---|---|---|
$id | int | The identity record id. |
$memberId | int | The member the record belongs to. |
$addedTimestamp | CalendarDateTimeData | When the record was added. |
__construct
new MemberIdentityData(int $id = 0, int $memberId = 0, CalendarDateTimeData $addedTimestamp = new CalendarDateTimeData())
Create a member identity data object.
MemberIdentityDatabase
Read and save member identity records. Records are immutable, so each change inserts a new row and the latest record is read back.
fromRow
MemberIdentityDatabase::fromRow(stdClass $row): MemberIdentityData
Convert a single database row to a MemberIdentityData object.
| Name | Type | Description |
|---|---|---|
$row | stdClass | A database row. |
Returns MemberIdentityData The identity data.
GetOptionalByMemberId
MemberIdentityDatabase::GetOptionalByMemberId(int $memberId): MemberIdentityData|null
Get the latest identity record for a member, or null when there is none.
| Name | Type | Description |
|---|---|---|
$memberId | int | The member id. |
Returns MemberIdentityData|null The identity data, or null.
Save
MemberIdentityDatabase::Save(int $memberId): void
Save an identity record for a member, inserting a new record if one does not exist.
| Name | Type | Description |
|---|---|---|
$memberId | int | The member id. |
Returns void
MemberIdentityDetailTypeData
Immutable data for a stored detail type, holding its name and the time it was added.
Properties
| Name | Type | Description |
|---|---|---|
$id | int | The detail type id. |
$name | string | The detail type name. |
$addedTimestamp | CalendarDateTimeData | When the detail type was added. |
__construct
new MemberIdentityDetailTypeData(int $id = 0, string $name = '', CalendarDateTimeData $addedTimestamp = new CalendarDateTimeData())
Create a detail type data object.
MemberIdentityDetailTypeDatabase
Read stored detail types from the detail type table.
fromRow
MemberIdentityDetailTypeDatabase::fromRow(stdClass $row): MemberIdentityDetailTypeData
Convert a single database row to a MemberIdentityDetailTypeData object.
| Name | Type | Description |
|---|---|---|
$row | stdClass | A database row. |
Returns MemberIdentityDetailTypeData The detail type data.
GetAll
MemberIdentityDetailTypeDatabase::GetAll(): array
Get all detail types, ordered by id.
Returns array A list of MemberIdentityDetailTypeData.
GetById
MemberIdentityDetailTypeDatabase::GetById(int $detailTypeId): MemberIdentityDetailTypeData
Get a detail type by its id.
| Name | Type | Description |
|---|---|---|
$detailTypeId | int | The detail type id. |
Returns MemberIdentityDetailTypeData The detail type data.
GetOptionalById
MemberIdentityDetailTypeDatabase::GetOptionalById(int $detailTypeId): MemberIdentityDetailTypeData|null
Get a detail type by its id, or null when there is no match.
| Name | Type | Description |
|---|---|---|
$detailTypeId | int | The detail type id. |
Returns MemberIdentityDetailTypeData|null The detail type data, or null.
MemberIdentityDetailValueData
Immutable data for a member's detail value, keyed by module and type name.
Properties
| Name | Type | Description |
|---|---|---|
$id | int | The detail value id. |
$memberId | int | The member the value belongs to. |
$moduleName | string | The module that owns the value. |
$typeName | string | The detail type name. |
$value | string | The stored value. |
$addedTimestamp | CalendarDateTimeData | When the value was added. |
__construct
new MemberIdentityDetailValueData(int $id = 0, int $memberId = 0, string $moduleName = '', string $typeName = '', string $value = '', CalendarDateTimeData $addedTimestamp = new CalendarDateTimeData())
Create a detail value data object.
MemberIdentityDetailValueDatabase
Read and save member detail values. Saving follows an immutable pattern, always inserting a new row, so the latest value per module and type is read back.
fromRow
MemberIdentityDetailValueDatabase::fromRow(stdClass $row): MemberIdentityDetailValueData
Convert a single database row to a MemberIdentityDetailValueData object.
| Name | Type | Description |
|---|---|---|
$row | stdClass | A database row. |
Returns MemberIdentityDetailValueData The detail value data.
GetById
MemberIdentityDetailValueDatabase::GetById(int $detailValueId): MemberIdentityDetailValueData
Get a detail value by its id.
| Name | Type | Description |
|---|---|---|
$detailValueId | int | The detail value id. |
Returns MemberIdentityDetailValueData The detail value data.
GetLatestByMemberId
MemberIdentityDetailValueDatabase::GetLatestByMemberId(int $memberId): array
Get all latest detail values for a member, one per module and type combination, keyed by "moduleName.typeName".
| Name | Type | Description |
|---|---|---|
$memberId | int | The member id. |
Returns array A map of "moduleName.typeName" to MemberIdentityDetailValueData.
GetLatestByMemberIdAndModule
MemberIdentityDetailValueDatabase::GetLatestByMemberIdAndModule(int $memberId, string $moduleName): array
Get all latest detail values for a member filtered by module name, keyed by type name.
| Name | Type | Description |
|---|---|---|
$memberId | int | The member id. |
$moduleName | string | The module to filter by. |
Returns array A map of type name to MemberIdentityDetailValueData.
GetLatestByMemberIds
MemberIdentityDetailValueDatabase::GetLatestByMemberIds(array $memberIds): array
Get latest detail values for multiple members in one lookup.
| Name | Type | Description |
|---|---|---|
$memberIds | array | A list of member ids. |
Returns array A map of member id to a map of "moduleName.typeName" to MemberIdentityDetailValueData.
GetLatestValue
MemberIdentityDetailValueDatabase::GetLatestValue(int $memberId, string $moduleName, string $typeName): MemberIdentityDetailValueData|null
Get the latest detail value for a member, module and type, or null when there is none.
| Name | Type | Description |
|---|---|---|
$memberId | int | The member id. |
$moduleName | string | The module that owns the value. |
$typeName | string | The detail type name. |
Returns MemberIdentityDetailValueData|null The latest detail value, or null.
Save
MemberIdentityDetailValueDatabase::Save(int $memberId, string $moduleName, string $typeName, string $value): int
Save a new detail value, always inserting a new row.
| Name | Type | Description |
|---|---|---|
$memberId | int | The member id. |
$moduleName | string | The module that owns the value. |
$typeName | string | The detail type name. |
$value | string | The value to store. |
Returns int The new detail value id.
MemberIdentityDocumentData
Immutable data for a stored identity document, holding the document type, its stored file and any linked support ticket.
Properties
| Name | Type | Description |
|---|---|---|
$id | int | The document id. |
$memberId | int | The member the document belongs to. |
$documentModuleName | string | The module that owns the document type. |
$documentTypeName | string | The document type name. |
$storageId | int | The stored file id. |
$active | bool | Whether the document is active. |
$addedTimestamp | CalendarDateTimeData | When the document was added. |
$optionalSupportTicketId | int|null | The linked support ticket id, or null. |
__construct
new MemberIdentityDocumentData(int $id = 0, int $memberId = 0, string $documentModuleName = '', string $documentTypeName = '', int $storageId = 0, bool $active = true, CalendarDateTimeData $addedTimestamp = new CalendarDateTimeData(), int|null $supportTicketId = null)
Create an identity document data object.
MemberIdentityDocumentDatabase
Read and update stored identity documents, including reading a member's active documents and counting submitted and verified documents across many members.
fromRow
MemberIdentityDocumentDatabase::fromRow(stdClass $row): MemberIdentityDocumentData
Convert a single database row to a MemberIdentityDocumentData object.
| Name | Type | Description |
|---|---|---|
$row | stdClass | A database row. |
Returns MemberIdentityDocumentData The document data.
fromRows
MemberIdentityDocumentDatabase::fromRows(array $rows): array
Convert multiple database rows to MemberIdentityDocumentData objects.
| Name | Type | Description |
|---|---|---|
$rows | array | A list of database rows. |
Returns array A list of MemberIdentityDocumentData.
GetActiveDocumentsList
MemberIdentityDocumentDatabase::GetActiveDocumentsList(int $memberId): array
Get a member's active documents, the latest of each type, keyed by "moduleName.documentTypeName".
| Name | Type | Description |
|---|---|---|
$memberId | int | The member id. |
Returns array A map of "moduleName.documentTypeName" to MemberIdentityDocumentData.
GetById
MemberIdentityDocumentDatabase::GetById(int $documentId): MemberIdentityDocumentData
Get a document by its id. Throws when the document is not found.
| Name | Type | Description |
|---|---|---|
$documentId | int | The document id. |
Returns MemberIdentityDocumentData The document data.
GetCountsByMemberIDs
MemberIdentityDocumentDatabase::GetCountsByMemberIDs(array $memberIds): array
Get submitted and verified document counts per member, counting the latest document of each type.
| Name | Type | Description |
|---|---|---|
$memberIds | array | A list of member ids. |
Returns array A map of member id to a map with verified and submitted counts.
SetSupportTicketID
MemberIdentityDocumentDatabase::SetSupportTicketID(int $documentId, int $supportTicketId): void
Set the support ticket id for a document.
| Name | Type | Description |
|---|---|---|
$documentId | int | The document id. |
$supportTicketId | int | The support ticket id. |
Returns void
MemberIdentityDocumentQueue
Queue processing for identity documents. Raises a support ticket for a document that does not yet have one, then records the ticket id against the document.
Process
MemberIdentityDocumentQueue::Process(int $documentId): void
Process a document by creating a support ticket for it, then linking the ticket to the document.
| Name | Type | Description |
|---|---|---|
$documentId | int | The document id to process. |
Returns void
MemberIdentityDocumentTicketQueueDatabase
The document ticket queue callbacks: lock the next driver documents that need a support ticket, and process a locked document into a ticket.
LockNext
MemberIdentityDocumentTicketQueueDatabase::LockNext(int $limit): array
Lock and return document ids for driver documents that do not yet have a support ticket, using SELECT FOR UPDATE SKIP LOCKED. Used for both counting and processing.
| Name | Type | Description |
|---|---|---|
$limit | int | The maximum number of rows to lock and return. |
Returns array A list of integer document ids, empty when none are available.
Process
MemberIdentityDocumentTicketQueueDatabase::Process(int $documentId): void
Process a driver document by creating a support ticket for it, then linking the ticket to the document.
| Name | Type | Description |
|---|---|---|
$documentId | int | The document id to process. |
Returns void
MemberIdentityDocumentTypeData
Immutable data for a registered document type, holding the module that owns it, its identifier and its display label.
Properties
| Name | Type | Description |
|---|---|---|
$moduleName | string | The module that owns the document type. |
$documentTypeName | string | The document type identifier. |
$label | string | The display label. |
__construct
new MemberIdentityDocumentTypeData(string $moduleName = '', string $documentTypeName = '', string $label = '')
Create a document type data object.