KMP PHP API Reference

WorkflowEntityRegistry
in package

Workflow Entity Registry

Static registry for entity types that workflows can operate on. Plugins register their entity types with schema info (e.g., 'Officers.Officers') for use in the workflow variable picker. Follows the ViewCellRegistry pattern.

Table of Contents

Constants

DISCOVERY_EXCLUDED_ALIAS_PATTERNS  : mixed = ['/(?:^|\.)Notes$/i', '/Log/i', '/Audit/i', '/T...
Auto-discovery skips tables that are usually operational or sensitive.
REQUIRED_FIELDS  : mixed = ['entityType', 'label', 'description', 'tableCl...
Required fields for each entity registration.
SENSITIVE_FIELD_PATTERNS  : mixed = ['/password/i', '/token/i', '/secret/i', '/api[...
Column names matching these patterns are not exposed from reflected schemas.

Properties

$entities  : array<string|int, mixed>
$initialized  : bool
$schemaEntities  : array<string|int, mixed>|null

Methods

clear()  : void
Clear all registered entities.
getAllEntities()  : array<string|int, mixed>
Get all registered entities.
getDebugInfo()  : array<string|int, mixed>
Get debug information about registered entities.
getEntitiesBySource()  : array<string|int, mixed>
Get entities for a specific source.
getEntity()  : array<string|int, mixed>|null
Get a single entity by entity type.
getEntityWithSchema()  : array<string|int, mixed>|null
Get a workflow entity with Cake schema-reflected fields when available.
getForDesigner()  : array<string|int, mixed>
Get a simplified view for the visual designer UI.
getRegisteredSources()  : array<string|int, mixed>
Get all registered source identifiers.
isRegistered()  : bool
Check if a source is registered.
register()  : void
Register entities from a source plugin.
unregister()  : void
Remove entities from a specific source.
discoverSchemaEntities()  : array<string, array<string|int, mixed>>
Discover workflow-safe Cake table schemas for the designer and lookup action.
discoverTableAliases()  : array<string|int, string>
Discover loaded app/plugin table aliases from Table classes.
enrichEntityWithSchema()  : array<string|int, mixed>
Enrich a registered entity with safe schema fields from its Cake table.
ensureInitialized()  : void
Ensure the registry is initialized.
entityTypeForAlias()  : string
Convert a Cake table alias to a workflow entity type.
filterSensitiveFields()  : array<string|int, mixed>
Filter sensitive fields from a registered entity.
isDiscoveryExcludedAlias()  : bool
Check whether a table should be hidden from reflected workflow objects.
isJoinTable()  : bool
Skip simple many-to-many join tables from generic workflow object lists.
isSensitiveField()  : bool
Check whether a field should be hidden from reflected workflow data.
scanTableDir()  : array<string|int, string>
Scan a table directory for Cake table aliases.
schemaFieldsForTable()  : array<string, array<string|int, mixed>>
Get safe workflow field metadata from a Cake table schema.
tableAliasForEntity()  : string
Resolve entity metadata to a Cake table alias.
tableForEntity()  : Table|null
Resolve a table from registered entity metadata.
validateRequiredFields()  : void
Validate that required fields are present in a registration entry.
workflowTypeForSchemaType()  : string
Map Cake schema types to workflow-designer variable types.

Constants

DISCOVERY_EXCLUDED_ALIAS_PATTERNS

Auto-discovery skips tables that are usually operational or sensitive.

private mixed DISCOVERY_EXCLUDED_ALIAS_PATTERNS = ['/(?:^|\.)Notes$/i', '/Log/i', '/Audit/i', '/Token/i', '/Secret/i', '/Password/i']

REQUIRED_FIELDS

Required fields for each entity registration.

private mixed REQUIRED_FIELDS = ['entityType', 'label', 'description', 'tableClass', 'fields']

SENSITIVE_FIELD_PATTERNS

Column names matching these patterns are not exposed from reflected schemas.

private mixed SENSITIVE_FIELD_PATTERNS = ['/password/i', '/token/i', '/secret/i', '/api[_-]?key/i', '/private[_-]?key/i', '/salt/i', '/hash/i']

Properties

Methods

getAllEntities()

Get all registered entities.

public static getAllEntities() : array<string|int, mixed>
Return values
array<string|int, mixed>

All entities keyed by source

getDebugInfo()

Get debug information about registered entities.

public static getDebugInfo() : array<string|int, mixed>
Return values
array<string|int, mixed>

Debug information

getEntitiesBySource()

Get entities for a specific source.

public static getEntitiesBySource(string $source) : array<string|int, mixed>
Parameters
$source : string

Source identifier

Return values
array<string|int, mixed>

Entities from the specified source

getEntity()

Get a single entity by entity type.

public static getEntity(string $entityType) : array<string|int, mixed>|null
Parameters
$entityType : string

Entity type identifier (e.g., 'Officers.Officers')

Return values
array<string|int, mixed>|null

Entity configuration or null if not found

getEntityWithSchema()

Get a workflow entity with Cake schema-reflected fields when available.

public static getEntityWithSchema(string $entityType) : array<string|int, mixed>|null
Parameters
$entityType : string

Entity type identifier

Return values
array<string|int, mixed>|null

Entity configuration or null if not found

getForDesigner()

Get a simplified view for the visual designer UI.

public static getForDesigner([bool $includeDiscovered = false ]) : array<string|int, mixed>
Parameters
$includeDiscovered : bool = false
Return values
array<string|int, mixed>

Designer-safe entity data (no class names)

getRegisteredSources()

Get all registered source identifiers.

public static getRegisteredSources() : array<string|int, mixed>
Return values
array<string|int, mixed>

List of registered source identifiers

isRegistered()

Check if a source is registered.

public static isRegistered(string $source) : bool
Parameters
$source : string

Source identifier

Return values
bool

True if registered

register()

Register entities from a source plugin.

public static register(string $source, array<string|int, mixed> $entities) : void
Parameters
$source : string

Source identifier (e.g., 'Officers', 'Awards')

$entities : array<string|int, mixed>

Array of entity configurations

Tags
throws
InvalidArgumentException

If required fields are missing

unregister()

Remove entities from a specific source.

public static unregister(string $source) : void
Parameters
$source : string

Source identifier to remove

discoverSchemaEntities()

Discover workflow-safe Cake table schemas for the designer and lookup action.

private static discoverSchemaEntities() : array<string, array<string|int, mixed>>
Return values
array<string, array<string|int, mixed>>

discoverTableAliases()

Discover loaded app/plugin table aliases from Table classes.

private static discoverTableAliases() : array<string|int, string>
Return values
array<string|int, string>

enrichEntityWithSchema()

Enrich a registered entity with safe schema fields from its Cake table.

private static enrichEntityWithSchema(array<string|int, mixed> $entity) : array<string|int, mixed>
Parameters
$entity : array<string|int, mixed>

Registered entity data

Return values
array<string|int, mixed>

Entity data with reflected fields merged in

ensureInitialized()

Ensure the registry is initialized.

private static ensureInitialized() : void

entityTypeForAlias()

Convert a Cake table alias to a workflow entity type.

private static entityTypeForAlias(string $alias) : string
Parameters
$alias : string

Cake table alias

Return values
string

filterSensitiveFields()

Filter sensitive fields from a registered entity.

private static filterSensitiveFields(array<string|int, mixed> $entity) : array<string|int, mixed>
Parameters
$entity : array<string|int, mixed>

Entity registration

Return values
array<string|int, mixed>

isDiscoveryExcludedAlias()

Check whether a table should be hidden from reflected workflow objects.

private static isDiscoveryExcludedAlias(string $alias) : bool
Parameters
$alias : string

Cake table alias

Return values
bool

isJoinTable()

Skip simple many-to-many join tables from generic workflow object lists.

private static isJoinTable(Table $table) : bool
Parameters
$table : Table

Cake table

Return values
bool

isSensitiveField()

Check whether a field should be hidden from reflected workflow data.

private static isSensitiveField(string $field) : bool
Parameters
$field : string

Field name

Return values
bool

scanTableDir()

Scan a table directory for Cake table aliases.

private static scanTableDir(string $path[, string|null $plugin = null ]) : array<string|int, string>
Parameters
$path : string

Directory path

$plugin : string|null = null

Plugin prefix

Return values
array<string|int, string>

schemaFieldsForTable()

Get safe workflow field metadata from a Cake table schema.

private static schemaFieldsForTable(Table $table) : array<string, array<string|int, mixed>>
Parameters
$table : Table

Cake table

Return values
array<string, array<string|int, mixed>>

tableAliasForEntity()

Resolve entity metadata to a Cake table alias.

private static tableAliasForEntity(array<string|int, mixed> $entity) : string
Parameters
$entity : array<string|int, mixed>

Entity metadata

Return values
string

tableForEntity()

Resolve a table from registered entity metadata.

private static tableForEntity(array<string|int, mixed> $entity) : Table|null
Parameters
$entity : array<string|int, mixed>

Entity metadata

Return values
Table|null

validateRequiredFields()

Validate that required fields are present in a registration entry.

private static validateRequiredFields(array<string|int, mixed> $entry, array<string|int, mixed> $requiredFields, string $source) : void
Parameters
$entry : array<string|int, mixed>

Registration entry to validate

$requiredFields : array<string|int, mixed>

Required field names

$source : string

Source identifier for error messages

Tags
throws
InvalidArgumentException

If required fields are missing

workflowTypeForSchemaType()

Map Cake schema types to workflow-designer variable types.

private static workflowTypeForSchemaType(string $schemaType) : string
Parameters
$schemaType : string

Cake schema column type

Return values
string
On this page

Search results