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.

Classes

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.

NameTypeDescription
$moduleNamestringModule name, for example FrenziDriver.
$typeNamestringType name, for example firstName.
$labelstringDisplay label, for example First Name.
$inputTypestringInput type, for example text, date or textarea.
$defaultstringDefault value.

Returns void

DocumentType

MemberIdentityConfig::DocumentType(string $moduleName, string $documentTypeName, string $label): void

Register a document type for a module.

NameTypeDescription
$moduleNamestringModule name, for example FrenziMember.
$documentTypeNamestringDocument type identifier, for example passport.
$labelstringDisplay 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.

NameTypeDescription
$moduleNamestringThe module that registered the type.
$typeNamestringThe 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.

NameTypeDescription
$moduleNamestringThe 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.

NameTypeDescription
$moduleNamestringThe module that registered the type.
$documentTypeNamestringThe 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.

NameTypeDescription
$moduleNamestringThe 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.

NameTypeDescription
$moduleNamestringThe module that registered the type.
$documentTypeNamestringThe 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

NameTypeDescription
$idintThe address record id.
$memberIdintThe member the address belongs to.
$locationAddressIdintThe Location address record id.
$addedTimestampCalendarDateTimeDataWhen the address was added.
Functions

__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.

NameTypeDescription
$rowstdClassA database row.

Returns MemberIdentityAddressData The address data.

GetById

MemberIdentityAddressDatabase::GetById(int $addressId): MemberIdentityAddressData

Get an address by its id.

NameTypeDescription
$addressIdintThe address record id.

Returns MemberIdentityAddressData The address data.

GetByMemberId

MemberIdentityAddressDatabase::GetByMemberId(int $memberId): array

Get all addresses for a member, most recent first.

NameTypeDescription
$memberIdintThe 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.

NameTypeDescription
$memberIdintThe 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.

NameTypeDescription
$memberIdintThe member id.
$locationAddressIdintThe 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

NameTypeDescription
$idintThe identity record id.
$memberIdintThe member the record belongs to.
$addedTimestampCalendarDateTimeDataWhen the record was added.
Functions

__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.

NameTypeDescription
$rowstdClassA 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.

NameTypeDescription
$memberIdintThe 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.

NameTypeDescription
$memberIdintThe member id.

Returns void

MemberIdentityDetailTypeData

Immutable data for a stored detail type, holding its name and the time it was added.

Properties

NameTypeDescription
$idintThe detail type id.
$namestringThe detail type name.
$addedTimestampCalendarDateTimeDataWhen the detail type was added.
Functions

__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.

NameTypeDescription
$rowstdClassA 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.

NameTypeDescription
$detailTypeIdintThe 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.

NameTypeDescription
$detailTypeIdintThe 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

NameTypeDescription
$idintThe detail value id.
$memberIdintThe member the value belongs to.
$moduleNamestringThe module that owns the value.
$typeNamestringThe detail type name.
$valuestringThe stored value.
$addedTimestampCalendarDateTimeDataWhen the value was added.
Functions

__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.

NameTypeDescription
$rowstdClassA database row.

Returns MemberIdentityDetailValueData The detail value data.

GetById

MemberIdentityDetailValueDatabase::GetById(int $detailValueId): MemberIdentityDetailValueData

Get a detail value by its id.

NameTypeDescription
$detailValueIdintThe 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".

NameTypeDescription
$memberIdintThe 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.

NameTypeDescription
$memberIdintThe member id.
$moduleNamestringThe 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.

NameTypeDescription
$memberIdsarrayA 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.

NameTypeDescription
$memberIdintThe member id.
$moduleNamestringThe module that owns the value.
$typeNamestringThe 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.

NameTypeDescription
$memberIdintThe member id.
$moduleNamestringThe module that owns the value.
$typeNamestringThe detail type name.
$valuestringThe 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

NameTypeDescription
$idintThe document id.
$memberIdintThe member the document belongs to.
$documentModuleNamestringThe module that owns the document type.
$documentTypeNamestringThe document type name.
$storageIdintThe stored file id.
$activeboolWhether the document is active.
$addedTimestampCalendarDateTimeDataWhen the document was added.
$optionalSupportTicketIdint|nullThe linked support ticket id, or null.
Functions

__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.

NameTypeDescription
$rowstdClassA database row.

Returns MemberIdentityDocumentData The document data.

fromRows

MemberIdentityDocumentDatabase::fromRows(array $rows): array

Convert multiple database rows to MemberIdentityDocumentData objects.

NameTypeDescription
$rowsarrayA 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".

NameTypeDescription
$memberIdintThe 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.

NameTypeDescription
$documentIdintThe 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.

NameTypeDescription
$memberIdsarrayA 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.

NameTypeDescription
$documentIdintThe document id.
$supportTicketIdintThe 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.

Functions

Process

MemberIdentityDocumentQueue::Process(int $documentId): void

Process a document by creating a support ticket for it, then linking the ticket to the document.

NameTypeDescription
$documentIdintThe 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.

Functions

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.

NameTypeDescription
$limitintThe 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.

NameTypeDescription
$documentIdintThe 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

NameTypeDescription
$moduleNamestringThe module that owns the document type.
$documentTypeNamestringThe document type identifier.
$labelstringThe display label.
Functions

__construct

new MemberIdentityDocumentTypeData(string $moduleName = '', string $documentTypeName = '', string $label = '')

Create a document type data object.