KMP PHP API Reference

BestowalsController extends AppController
in package
uses DataverseGridTrait, WorkflowDispatchTrait

Bestowals Controller

Manages award bestowal workflow UI with Dataverse grids and workflow dispatch.

Table of Contents

Constants

MOBILE_QUEUE_DEFAULT_PER_PAGE  : int = 25
MOBILE_QUEUE_MAX_PER_PAGE  : int = 50
VIEW_DATA_EVENT  : string = 'KMP.plugins.callForViewData'
VIEW_PLUGIN_EVENT  : string = 'KMP.plugins.callForViewCells'

Properties

$Bestowals  : BestowalsTable
$isCsvRequest  : bool
$pluginViewCells  : array<string|int, mixed>
$pluginViewCellsEnabledForFragment  : bool
Whether an intentionally fragment-style response still needs plugin view cells.
$fieldAccessService  : BestowalFieldAccessService

Methods

adHoc()  : Response|null
Record an ad-hoc bestowal via workflow dispatch.
beforeFilter()  : Response|null|void
Pre-action filter for application-wide processing.
beforeRender()  : Response|null|void
Finalize view-only data after the action has run.
bestowalTodos()  : Response|null
Render a single bestowal's to-do checklist for the quick To-Dos modal.
bulkAssignGathering()  : Response|null
Bulk assign selected bestowals to a gathering and optionally complete the matching required-field to-do.
bulkCompleteTodo()  : Response|null
Complete a single named check across many selected bestowals.
cancel()  : Response|null
Cancel a bestowal via workflow dispatch.
courtSlotsForGathering()  : Response|null
Return court slot options for a gathering as JSON.
edit()  : Response|null
Edit a bestowal via workflow dispatch.
gatheringBestowalsGridData()  : Response|null|void
Grid data for bestowals on a gathering detail tab.
gatheringsForBestowalAutoComplete()  : void
Return gathering autocomplete options for a single bestowal edit form.
gridData()  : Response|null|void
Grid data for the main bestowals index.
index()  : Response|null|void
Bestowals index landing page with lazy-loaded grid.
initialize()  : void
Initialize Awards Plugin Base Controller.
isCsvRequest()  : bool
Check if current request is for CSV export.
markGiven()  : Response|null
Explicitly finalize through the current terminal task, or legacy gating rules.
switchView()  : Response
Switch between mobile and desktop view modes.
turboEditForm()  : Response|null
Render a populated edit form for Turbo Frame partial updates.
view()  : Response|null|void
View a single bestowal record.
applyCustomFilterHandlers()  : SelectQuery
Apply custom filter handlers for columns with complex filtering logic
appSettingImageDataUri()  : string|null
Resolve shared tenant branding for the online and cached mobile templates.
assertSafeContextUrl()  : string
Ensure URL is same-origin relative path + query only.
authorizeCurrentUrl()  : void
Authorize the current URL/action via Authorization component.
buildAwardsHtml()  : string
buildBestowalTodoContext()  : array<string, mixed>
Build the shared bestowal to-do view context: items, per-item eligibility, gating counts, progress percentage, the all-gating-complete flag and the current-page return URL used by the gated Complete / Reopen links.
buildBestowalTodoSummaryHtml()  : string
Render the compact open to-do count with a popover listing each check and its state. The badge's accessible name also conveys required-check progress.
buildCourtSlotHtml()  : string
buildDataverseGridSearchCondition()  : array<string, mixed>|null
Build a search condition for one Dataverse grid column.
buildDataverseGridState()  : array<string|int, mixed>
Build complete grid state object (single source of truth)
buildExportDataFromEntities()  : array<string|int, mixed>
Build export data from pre-processed entities (Data Mode)
buildExportDataFromQuery()  : array<string|int, mixed>
Build export data from database query (Query Mode)
buildGridDataUrlFromPageContext()  : string
Build grid-data URL preserving query string from page context.
buildHeraldNotesPreviewHtml()  : string
buildRecommendationReasonsHtml()  : string
consumeFlashForStream()  : array<string, mixed>
Read flash from session and clear it for stream rendering.
convertDateBoundaryToUtc()  : string
Convert a date boundary string from kingdom timezone to UTC for SQL comparison.
dispatchWorkflowEvent()  : void
Fire a workflow event without fallback. Silently logs on failure.
dispatchWorkflowOrFail()  : array<int, mixed>
Dispatch to the workflow engine and fail when no active definition is available.
enablePluginViewCellsForFragment()  : void
Include route-matched plugin cells in an AJAX or other fragment response.
extractContextValue()  : mixed
Extract a matching value from the workflow context or its nested payload arrays.
extractExportValue()  : string
Extract export value from entity using column metadata
extractFilterFromExpression()  : mixed
Recursively extract a filter value from an expression tree
extractFilterFromSystemView()  : mixed
Extract a specific filter value from a system view configuration
extractFilterFromViewConfig()  : mixed
Extract a specific filter value from a saved user view's config
extractFilterGrouping()  : array<string|int, mixed>
Extract filter grouping information from expression tree
extractLockedDateRangeDefaults()  : array<string, array{value: string|null, operator: string}>
Extract canonical bounds for active date-range filters whose fields are locked.
extractNumericContextValue()  : int|null
Extract a numeric value from top-level or nested workflow context arrays.
extractStringContextValue()  : string|null
Extract a string value from top-level or nested workflow context arrays.
extractSystemViewDefaults()  : array{filters: array, dateRange: array, dateRangeOperators: array, search: ?string, skipFilterColumns: array}
Extract default filters/search metadata for a system view configuration
formatExportValue()  : string
Format value for CSV export
getPageContextUrl()  : string|null
Posted page context URL (path + query), validated.
handleCsvExport()  : Response
Handle CSV export from grid result
isCsvExportRequest()  : bool
Check if the current request is for CSV export
isDataverseTableFrameRequest()  : bool
isGridOriginRequest()  : bool
Whether POST originated from a grid index (stay on list).
loadAvailableViews()  : array<int, mixed>
Load and cache available views for the current request.
loadBestowalBulkTodoOptions()  : array<int, string>
Build per-row bulk completion options for open checks the current user may complete.
loadBestowalTodoSummaries()  : array<int, array<int, ActionItem>>
Batch-load preparation-check (to-do) action items for the given bestowal ids, grouped by bestowal id, ordered for checklist display.
loadFilterOptions()  : array<string|int, mixed>
Load filter options from a data source
loadFilterOptionsCached()  : array<int, array{value: string, label: string}>
Load filter options with per-request cache.
matchesGridIndexPath()  : bool
Whether page context path matches a grid index route pattern.
mobileQueuePagination()  : array<string, int|bool>
Build shared pagination values for mobile actionable queues.
mobileQueuePaginationPayload()  : array<string, int|bool>
Remove internal pagination values before sending the mobile JSON payload.
operationCategorySummary()  : string
Build a plain-text summary from trusted category labels and their counts.
operationReasonSummary()  : string
Build a bounded, plain-text count of operational result reasons.
organizeViewCells()  : array<string|int, mixed>
Organize view cells by type and display order.
prepareBestowalsForDisplay()  : iterable<string|int, Bestowal>
Add computed display fields to bestowal entities in place.
processDataverseGrid()  : array<string|int, mixed>
Process dataverse grid request with unified logic
renderDataverseGridResponse()  : void
Render consistent dataverse grid responses for outer/table turbo frames.
renderDataverseTableRowElement()  : string
Render a single Dataverse grid row element (Turbo Stream replace target HTML).
renderTurboCloseModal()  : Response
Render turbo-stream: flash + replace table frame with lazy reload src.
renderTurboFlashOnly()  : Response
Render turbo-stream flash messages without forcing a grid or frame reload.
renderTurboReloadFrame()  : Response
Stream that reloads an edit turbo-frame (validation errors).
renderTurboRemoveGridRow()  : Response
Render turbo-stream: flash + remove a grid row (no longer matches current filters).
renderTurboReplaceGridRow()  : Response
Render turbo-stream: flash + replace a single grid row by DOM id.
resolveBranchIdFromContextMember()  : int|null
Resolve a branch ID from member identifiers carried in workflow context.
resolveDataverseGridQueryContext()  : DataverseGridQueryContext
Resolve Dataverse grid column context for early query construction.
resolveKingdomId()  : int|null
Resolve the kingdom ID from the authenticated member or workflow context.
resolveKingdomIdFromBranch()  : int|null
Walk the branch parent chain to find the kingdom-type ancestor.
resolveNestedValue()  : mixed
Resolve nested value from entity using dot notation path
setGridViewVariables()  : void
wantsTurboStreamRequest()  : bool
Whether the client expects a turbo-stream response.
withPageContextQuery()  : T
Run a callback with query params from the posted page context URL.
actionItemCascadeWarning()  : string|null
Read a post-commit cascade warning from a successful to-do transition.
applyDataverseGridSort()  : SelectQuery
Apply a standard field sort or delegate to a column-specific sort handler.
buildTodoBlockedStatus()  : array<int, array<string, mixed>>
Build per-item prerequisite display status for bestowal checklist surfaces.
buildTodoRequirementStatus()  : array<int, array<string, mixed>>
Build per-item required-field display status for bestowal checklist surfaces.
bulkCascadeWarningSummary()  : string
Build a warning suffix for committed checks with incomplete related cascades.
bulkTodoOptionForItem()  : array<string, mixed>|null
collectDataverseExpressionColumnKeys()  : void
columnKeyForDataverseField()  : string
dispatchBestowalMutation()  : array{success: bool, data: array, error: ?string}
extractDataverseGridConfigColumnKeys()  : array<int, string>
filterRankedGatheringsByFlatList()  : array<int, array<string, mixed>>
findActiveDefinition()  : WorkflowDefinition|null
Find an active workflow definition by slug.
findOpenGatheringRequiredTodoInItems()  : ActionItem|null
Find the open gathering-required to-do for a bestowal.
findTodoBySourceRef()  : ActionItem|null
flashBulkGatheringSummary()  : void
Flash a human-readable summary of a bulk gathering assignment.
flashBulkTodoSummary()  : void
Flash a human-readable summary of a bulk check completion.
isDataverseGridNumericSearchColumn()  : bool
isTodoBlockedByPrerequisite()  : bool
isWorkflowDispatchResult()  : bool
loadBestowalActionItems()  : array<int, array<int, ActionItem>>
Batch-load to-do action items for selected bestowals.
normalizeBestowalMutationResult()  : array{success: bool, data: array, error: ?string}
normalizeDataverseGridColumnConfig()  : array<int, string>
normalizeLockedDateBoundary()  : string|null
Normalize a persisted date boundary while retaining an intentionally open bound.
pageContextQueryTab()  : string|null
Tab query param from page context URL (detail pages).
parseBulkBestowalIds()  : array<int, int>
Normalize the bulk bestowal id payload (CSV string or array) to unique ints.
positiveIntOrNull()  : int|null
redirectAfterBestowalMutation()  : Response|null
Resolve the post-mutation redirect target consistently with the other bestowal mutation actions.
resolveBestowalGridRowSync()  : array{action: string, rowDomId: string, rowHtml?: string}|null
Resolve targeted row sync after a single bestowal save.
resolveBestowalGridSyncContext()  : array{contextKey: string, tableFrameId: string, gatheringId?: int}|null
resolveDataverseGridActiveColumns()  : array<int, string>
Resolve hidden-but-active query dependency columns.
resolveDataverseGridViewContext()  : array{selectedSystemView: array|null, currentView: mixed}
Resolve active saved/system view enough for pre-query column dependency planning.
resolveDataverseGridVisibleColumns()  : array<int, string>
Resolve UI-visible columns using the same precedence as processDataverseGrid().
shouldLoadBestowalDisplayColumn()  : bool
tryBestowalsGridTurboResponse()  : Response|null
Turbo-stream response for grid-origin bestowal saves.
withBestowalsBulkSelectionGridOptions()  : array<string, mixed>
Add the bestowals index bulk-selection contract to grid options.

Constants

MOBILE_QUEUE_DEFAULT_PER_PAGE

public int MOBILE_QUEUE_DEFAULT_PER_PAGE = 25

Shared default page size for mobile actionable queues.

MOBILE_QUEUE_MAX_PER_PAGE

public int MOBILE_QUEUE_MAX_PER_PAGE = 50

Shared maximum page size for mobile actionable queues.

VIEW_DATA_EVENT

public string VIEW_DATA_EVENT = 'KMP.plugins.callForViewData'

Event for plugin view data enhancement

VIEW_PLUGIN_EVENT

public string VIEW_PLUGIN_EVENT = 'KMP.plugins.callForViewCells'

Event for plugin view cell registration

Properties

$isCsvRequest

protected bool $isCsvRequest = false

Whether current request is for CSV export (.csv extension)

$pluginViewCells

protected array<string|int, mixed> $pluginViewCells = []

View cells from plugins for current request

$pluginViewCellsEnabledForFragment

Whether an intentionally fragment-style response still needs plugin view cells.

protected bool $pluginViewCellsEnabledForFragment = false

Methods

beforeFilter()

Pre-action filter for application-wide processing.

public beforeFilter(EventInterface $event) : Response|null|void

Handles: plugin validation, navigation history, view cell loading, and Turbo Frame detection.

Parameters
$event : EventInterface

The beforeFilter event

Return values
Response|null|void

beforeRender()

Finalize view-only data after the action has run.

public beforeRender(EventInterface<string|int, Controller$event) : Response|null|void

Deferring view cells prevents redirect-only requests from executing badge callbacks.

Parameters
$event : EventInterface<string|int, Controller>

Event.

Return values
Response|null|void

bestowalTodos()

Render a single bestowal's to-do checklist for the quick To-Dos modal.

public bestowalTodos(ActionItemService $actionItemService[, string|null $id = null ]) : Response|null

Returns the parallel preparation checks with per-item eligibility so the grid modal can offer the same gated Complete / Reopen actions as the bestowal view tab, without a full page load.

Parameters
$actionItemService : ActionItemService

To-do service

$id : string|null = null

Bestowal ID

Return values
Response|null

bulkCompleteTodo()

Complete a single named check across many selected bestowals.

public bulkCompleteTodo(ActionItemService $actionItemService) : Response|null

Drives the grid "Complete Check" bulk action: for each selected bestowal the matching open to-do (by template item key) is completed, but only where the current member is an eligible doer for that check. Bestowals outside the member's authorization scope, without the check open, or where the member is not the assigned doer are skipped and reported in the summary.

Parameters
$actionItemService : ActionItemService

To-do service

Return values
Response|null

cancel()

Cancel a bestowal via workflow dispatch.

public cancel(TriggerDispatcher $triggerDispatcher[, int|null $id = null ]) : Response|null
Parameters
$triggerDispatcher : TriggerDispatcher

Workflow dispatcher

$id : int|null = null
Return values
Response|null

courtSlotsForGathering()

Return court slot options for a gathering as JSON.

public courtSlotsForGathering([int|null $gatheringId = null ]) : Response|null
Parameters
$gatheringId : int|null = null

Gathering ID

Return values
Response|null

edit()

Edit a bestowal via workflow dispatch.

public edit(TriggerDispatcher $triggerDispatcher[, string|null $id = null ]) : Response|null
Parameters
$triggerDispatcher : TriggerDispatcher

Workflow dispatcher

$id : string|null = null

Bestowal ID

Return values
Response|null

gatheringBestowalsGridData()

Grid data for bestowals on a gathering detail tab.

public gatheringBestowalsGridData(CsvExportService $csvExportService, BestowalQueryService $queryService[, int|null $gatheringId = null ]) : Response|null|void
Parameters
$csvExportService : CsvExportService

CSV export service

$queryService : BestowalQueryService

Bestowal query builder

$gatheringId : int|null = null

Gathering ID

Return values
Response|null|void

gatheringsForBestowalAutoComplete()

Return gathering autocomplete options for a single bestowal edit form.

public gatheringsForBestowalAutoComplete(BestowalGatheringLookupService $lookupService[, string|null $bestowalId = null ]) : void

Returns Ajax HTML list items consumed by the shared auto-complete controller.

Parameters
$lookupService : BestowalGatheringLookupService

Gathering lookup service

$bestowalId : string|null = null

Bestowal ID

index()

Bestowals index landing page with lazy-loaded grid.

public index() : Response|null|void
Return values
Response|null|void

isCsvRequest()

Check if current request is for CSV export.

public isCsvRequest() : bool
Return values
bool

markGiven()

Explicitly finalize through the current terminal task, or legacy gating rules.

public markGiven(BestowalFinalizationService $finalizationService) : Response|null

The service locks the bestowal before checking task eligibility and atomically updates its checklist, bestowed timestamp, and linked recommendations.

Parameters
$finalizationService : BestowalFinalizationService

Bestowal finalize service

Return values
Response|null

switchView()

Switch between mobile and desktop view modes.

public switchView() : Response

Stores preference in session and redirects to appropriate interface. Mobile redirects to viewMobileCard, desktop to profile.

Return values
Response

Redirect response

turboEditForm()

Render a populated edit form for Turbo Frame partial updates.

public turboEditForm(BestowalFormService $formService[, string|null $id = null ]) : Response|null
Parameters
$formService : BestowalFormService

Form preparation service

$id : string|null = null

Bestowal ID

Return values
Response|null

view()

View a single bestowal record.

public view(ActionItemService $actionItemService[, string|null $id = null ]) : Response|null|void
Parameters
$actionItemService : ActionItemService
$id : string|null = null

Bestowal ID

Return values
Response|null|void

applyCustomFilterHandlers()

Apply custom filter handlers for columns with complex filtering logic

protected applyCustomFilterHandlers(SelectQuery $query, array<string|int, mixed> $customFilterColumns, string $tableName, array<string|int, mixed> $currentFilters, mixed $currentView, array<string|int, mixed>|null $selectedSystemView, bool $dirtyFilters) : SelectQuery

Columns can define a customFilterHandler in their metadata to specify a static method that handles their filtering. This allows complex filter logic (like querying multiple tables) to be defined alongside the column definition rather than requiring special controller knowledge.

Filter values are extracted from:

  1. Canonical current filter state (query parameters plus enforced locked values)
  2. Saved user view configuration (when loading a saved view)
  3. System view configuration (when loading a system view)
Parameters
$query : SelectQuery

The query to filter

$customFilterColumns : array<string|int, mixed>

Columns with customFilterHandler defined

$tableName : string

The main table name

$currentFilters : array<string|int, mixed>

Current filter values from query params

$currentView : mixed

Current saved user view (or null)

$selectedSystemView : array<string|int, mixed>|null

Current system view config (or null)

$dirtyFilters : bool

Whether user explicitly modified filters

Return values
SelectQuery

The filtered query

appSettingImageDataUri()

Resolve shared tenant branding for the online and cached mobile templates.

protected appSettingImageDataUri(string $settingName) : string|null
Parameters
$settingName : string
Return values
string|null

assertSafeContextUrl()

Ensure URL is same-origin relative path + query only.

protected assertSafeContextUrl(string $url) : string
Parameters
$url : string
Tags
throws
BadRequestException
Return values
string

authorizeCurrentUrl()

Authorize the current URL/action via Authorization component.

protected authorizeCurrentUrl() : void
Tags
throws
ForbiddenException

When authorization fails

buildBestowalTodoContext()

Build the shared bestowal to-do view context: items, per-item eligibility, gating counts, progress percentage, the all-gating-complete flag and the current-page return URL used by the gated Complete / Reopen links.

protected buildBestowalTodoContext(Bestowal $bestowal, ActionItemService $actionItemService, int $memberId[, bool $isSuperUser = false ]) : array<string, mixed>
Parameters
$bestowal : Bestowal

Bestowal entity

$actionItemService : ActionItemService

To-do service

$memberId : int

Current member id

$isSuperUser : bool = false

Whether the current member can bypass to-do assignment

Return values
array<string, mixed>

buildBestowalTodoSummaryHtml()

Render the compact open to-do count with a popover listing each check and its state. The badge's accessible name also conveys required-check progress.

protected buildBestowalTodoSummaryHtml(array<int, ActionItem$items) : string
Parameters
$items : array<int, ActionItem>

Action items for one bestowal

Return values
string

buildDataverseGridSearchCondition()

Build a search condition for one Dataverse grid column.

protected buildDataverseGridSearchCondition(string $field, array<string, mixed>|null $columnMeta, string $searchTerm) : array<string, mixed>|null
Parameters
$field : string

Fully-qualified database field.

$columnMeta : array<string, mixed>|null

Column metadata, when available.

$searchTerm : string

User-entered search term.

Return values
array<string, mixed>|null

buildDataverseGridState()

Build complete grid state object (single source of truth)

protected buildDataverseGridState(mixed $currentView, array<string|int, mixed>|null $selectedSystemView, array<string|int, mixed>|null $systemViews, iterable<string|int, mixed> $availableViews, Member|null $currentMember, string|int|null $preferredViewId, string $search, array<string|int, mixed> $filters, array<string|int, mixed> $filterOptions, array<string|int, mixed> $dropdownFilterColumns, array<string|int, mixed> $dateRangeFilterColumns, array<string|int, mixed> $sort, array<string|int, mixed> $visibleColumns, array<string|int, mixed> $allColumns, string $gridKey, int $pageSize, bool $showAllTab, bool $canAddViews, bool $canFilter, bool $hasSearch, bool $hasDropdownFilters, bool $hasDateRangeFilters, array<string|int, mixed> $skipFilterColumns, bool $canExportCsv, bool $showFilterPills, bool $showViewTabs, bool $enableColumnPicker[, array<string|int, mixed> $lockedFilters = [] ][, bool $enableBulkSelection = false ][, array<string|int, mixed> $bulkSelection = [] ][, array<string|int, mixed> $bulkActions = [] ][, array<string|int, mixed> $bulkSelectionDataFields = [] ][, string|null $bulkSelectionDisabledField = null ][, bool $bulkSelectionHideDisabledControl = false ][, bool $includeViewMetadata = true ][, bool $includeAllColumns = true ]) : array<string|int, mixed>
Parameters
$currentView : mixed

Current saved view entity (null for system views or "All")

$selectedSystemView : array<string|int, mixed>|null

Currently selected system view

$systemViews : array<string|int, mixed>|null

All available system views

$availableViews : iterable<string|int, mixed>

Collection of saved views

$currentMember : Member|null

Authenticated member

$preferredViewId : string|int|null

Preferred view ID from user preferences

$search : string

Current search term

$filters : array<string|int, mixed>

Active filters by column key

$filterOptions : array<string|int, mixed>

Available filter options by column key

$dropdownFilterColumns : array<string|int, mixed>

Metadata for filterable columns

$dateRangeFilterColumns : array<string|int, mixed>
$sort : array<string|int, mixed>

Current sort configuration

$visibleColumns : array<string|int, mixed>

Array of visible column keys

$allColumns : array<string|int, mixed>

Complete column metadata

$gridKey : string

Unique grid identifier

$pageSize : int

Number of rows per page

$showAllTab : bool

Whether to show "All" tab

$canAddViews : bool

Whether users can create custom views

$canFilter : bool

Whether filtering is enabled

$hasSearch : bool
$hasDropdownFilters : bool
$hasDateRangeFilters : bool
$skipFilterColumns : array<string|int, mixed>

Columns with filter UI but not query application

$canExportCsv : bool

Whether CSV export button is shown

$showFilterPills : bool

Whether active filter pills/badges are displayed

$showViewTabs : bool

Whether view tabs are displayed

$enableColumnPicker : bool

Whether column picker is available

$lockedFilters : array<string|int, mixed> = []

Filter column keys that cannot be removed by users

$enableBulkSelection : bool = false
$bulkSelection : array<string|int, mixed> = []

Bulk selection accessibility label configuration

$bulkActions : array<string|int, mixed> = []
$bulkSelectionDataFields : array<string|int, mixed> = []
$bulkSelectionDisabledField : string|null = null
$bulkSelectionHideDisabledControl : bool = false
$includeViewMetadata : bool = true
$includeAllColumns : bool = true
Return values
array<string|int, mixed>

Complete grid state

buildExportDataFromEntities()

Build export data from pre-processed entities (Data Mode)

protected buildExportDataFromEntities(iterable<string|int, mixed> $data, array<string|int, mixed> $visibleColumns, array<string|int, mixed> $columnsMetadata) : array<string|int, mixed>

Extracts values from entities using column metadata configuration. Supports virtual properties, nested relations via renderField, and custom exportValue callbacks.

Parameters
$data : iterable<string|int, mixed>

Pre-processed entities or arrays

$visibleColumns : array<string|int, mixed>

List of visible column keys

$columnsMetadata : array<string|int, mixed>

Column configuration metadata

Return values
array<string|int, mixed>

Transformed data ready for CSV export

buildExportDataFromQuery()

Build export data from database query (Query Mode)

protected buildExportDataFromQuery(Query $query, array<string|int, mixed> $visibleColumns, array<string|int, mixed> $columnsMetadata, string $tableName) : array<string|int, mixed>

Builds SQL SELECT statements and executes query for simple database fields. Best for exports that don't require computed fields.

Parameters
$query : Query

Database query to execute

$visibleColumns : array<string|int, mixed>

List of visible column keys

$columnsMetadata : array<string|int, mixed>

Column configuration metadata

$tableName : string

Full table name for model alias extraction

Return values
array<string|int, mixed>

Transformed data ready for CSV export

buildGridDataUrlFromPageContext()

Build grid-data URL preserving query string from page context.

protected buildGridDataUrlFromPageContext(string|null $pageContextUrl, array<string, mixed> $gridDataRoute) : string
Parameters
$pageContextUrl : string|null
$gridDataRoute : array<string, mixed>

Cake URL array for gridData action

Return values
string

buildHeraldNotesPreviewHtml()

protected buildHeraldNotesPreviewHtml(Bestowal $bestowal) : string
Parameters
$bestowal : Bestowal

Bestowal entity

Return values
string

buildRecommendationReasonsHtml()

protected buildRecommendationReasonsHtml(Bestowal $bestowal) : string
Parameters
$bestowal : Bestowal

Bestowal entity

Return values
string

consumeFlashForStream()

Read flash from session and clear it for stream rendering.

protected consumeFlashForStream() : array<string, mixed>
Return values
array<string, mixed>

convertDateBoundaryToUtc()

Convert a date boundary string from kingdom timezone to UTC for SQL comparison.

protected convertDateBoundaryToUtc(string $dateValue, bool $isStart) : string

The database stores datetimes in UTC. Date-range filters use kingdom-timezone dates (e.g., "today" = 2026-04-09 in US/Eastern). Without conversion, a SQL comparison like start_on <= '2026-04-09 23:59:59' would miss records stored as '2026-04-10 03:00:00' UTC (which is still April 9 in Eastern).

Parameters
$dateValue : string

Date string (YYYY-MM-DD or YYYY-MM-DD HH:MM:SS)

$isStart : bool

True for start-of-day boundary (00:00:00), false for end-of-day (23:59:59)

Return values
string

UTC datetime string for SQL comparison

dispatchWorkflowEvent()

Fire a workflow event without fallback. Silently logs on failure.

protected dispatchWorkflowEvent(TriggerDispatcher $dispatcher, string $triggerEvent, array<string|int, mixed> $context) : void

Includes kingdom context from the authenticated user.

Parameters
$dispatcher : TriggerDispatcher

Workflow trigger dispatcher

$triggerEvent : string

Event name for the workflow engine

$context : array<string|int, mixed>

Event data / context for the workflow

dispatchWorkflowOrFail()

Dispatch to the workflow engine and fail when no active definition is available.

protected dispatchWorkflowOrFail(TriggerDispatcher $dispatcher, string $slug, string $triggerEvent, array<string|int, mixed> $context) : array<int, mixed>

Resolves the current kingdom from the authenticated user's branch hierarchy and includes it in the dispatch context.

Parameters
$dispatcher : TriggerDispatcher

Workflow trigger dispatcher

$slug : string

Workflow definition slug

$triggerEvent : string

Event name for the workflow engine

$context : array<string|int, mixed>

Event data / context for the workflow

Return values
array<int, mixed>

enablePluginViewCellsForFragment()

Include route-matched plugin cells in an AJAX or other fragment response.

protected enablePluginViewCellsForFragment() : void

extractContextValue()

Extract a matching value from the workflow context or its nested payload arrays.

protected extractContextValue(array<string, mixed> $context, array<int, string> $keys) : mixed
Parameters
$context : array<string, mixed>

Workflow trigger context.

$keys : array<int, string>

Keys to search for.

extractExportValue()

Extract export value from entity using column metadata

protected extractExportValue(mixed $entity, string $columnKey, array<string|int, mixed> $columnMeta) : string

Resolution order:

  1. exportValue callback if defined in column metadata
  2. renderField path for nested entity access (e.g., 'member.name_for_herald')
  3. Direct property access using column key
Parameters
$entity : mixed

Entity or array to extract value from

$columnKey : string

Column key identifier

$columnMeta : array<string|int, mixed>

Column metadata configuration

Return values
string

Extracted and formatted value

extractFilterFromExpression()

Recursively extract a filter value from an expression tree

protected extractFilterFromExpression(array<string|int, mixed> $expression, string $columnKey) : mixed
Parameters
$expression : array<string|int, mixed>

The expression node to search

$columnKey : string

The column key to find

Return values
mixed

The filter value or null if not found

extractFilterFromSystemView()

Extract a specific filter value from a system view configuration

protected extractFilterFromSystemView(array<string|int, mixed> $systemView, string $columnKey) : mixed
Parameters
$systemView : array<string|int, mixed>

The system view configuration

$columnKey : string

The column key to find

Return values
mixed

The filter value or null if not found

extractFilterFromViewConfig()

Extract a specific filter value from a saved user view's config

protected extractFilterFromViewConfig(mixed $view, string $columnKey) : mixed
Parameters
$view : mixed

The GridView entity

$columnKey : string

The column key to find

Return values
mixed

The filter value or null if not found

extractFilterGrouping()

Extract filter grouping information from expression tree

protected extractFilterGrouping(array<string|int, mixed>|null $selectedSystemView, array<string|int, mixed> $skipFilterColumns) : array<string|int, mixed>

Analyzes the expression tree to determine OR relationships between filters. Returns metadata that the frontend can use to display visual OR indicators.

Parameters
$selectedSystemView : array<string|int, mixed>|null

Currently active system view

$skipFilterColumns : array<string|int, mixed>

Columns that show as pills but don't query

Return values
array<string|int, mixed>

Grouping metadata with 'orGroups' array

extractLockedDateRangeDefaults()

Extract canonical bounds for active date-range filters whose fields are locked.

protected extractLockedDateRangeDefaults(array<string, mixed> $viewConfig, array<int, string> $lockedFilters, array<string, array<string, mixed>> $columnsMetadata) : array<string, array{value: string|null, operator: string}>
Parameters
$viewConfig : array<string, mixed>

Active system or saved-view config.

$lockedFilters : array<int, string>

Locked filter keys.

$columnsMetadata : array<string, array<string, mixed>>

Grid column metadata.

Return values
array<string, array{value: string|null, operator: string}>

Date parameter bounds.

extractNumericContextValue()

Extract a numeric value from top-level or nested workflow context arrays.

protected extractNumericContextValue(array<string, mixed> $context, array<int, string> $keys) : int|null
Parameters
$context : array<string, mixed>

Workflow trigger context.

$keys : array<int, string>

Keys to search for.

Return values
int|null

extractStringContextValue()

Extract a string value from top-level or nested workflow context arrays.

protected extractStringContextValue(array<string, mixed> $context, array<int, string> $keys) : string|null
Parameters
$context : array<string, mixed>

Workflow trigger context.

$keys : array<int, string>

Keys to search for.

Return values
string|null

extractSystemViewDefaults()

Extract default filters/search metadata for a system view configuration

protected extractSystemViewDefaults(array<string, mixed> $systemViewConfig) : array{filters: array, dateRange: array, dateRangeOperators: array, search: ?string, skipFilterColumns: array}
Parameters
$systemViewConfig : array<string, mixed>

Raw system view config

Return values
array{filters: array, dateRange: array, dateRangeOperators: array, search: ?string, skipFilterColumns: array}

formatExportValue()

Format value for CSV export

protected formatExportValue(mixed $value) : string

Handles various data types and converts to string representation.

Parameters
$value : mixed

Value to format

Return values
string

Formatted string value

getPageContextUrl()

Posted page context URL (path + query), validated.

protected getPageContextUrl() : string|null
Return values
string|null

handleCsvExport()

Handle CSV export from grid result

protected handleCsvExport(array<string|int, mixed> $result, CsvExportService $csvExportService, string $entityName[, string|null $tableName = null ][, iterable<string|int, mixed>|null $data = null ]) : Response

Generates a CSV export response from the grid processing result. Supports two modes:

  1. Query Mode (default): Uses the query from result to build SQL SELECT statements. Best for simple fields that map directly to database columns.

  2. Data Mode: Pass pre-processed data with computed/virtual fields already populated. Best for exports that include calculated fields, virtual properties, or complex transformations that can't be done in SQL.

Column Value Resolution (in order of precedence):

  1. exportValue callback in column metadata - custom formatting function
  2. renderField path (e.g., 'member.name_for_herald') - for nested entity access
  3. queryField for relation columns in query mode
  4. Direct column key access on entity/array
Parameters
$result : array<string|int, mixed>

Result from processDataverseGrid() with isCsvExport flag

$csvExportService : CsvExportService

CSV export service instance

$entityName : string

Base name for the export file (e.g., 'members', 'warrants')

$tableName : string|null = null

Optional table name for fetchTable (e.g., 'Awards.Recommendations' for plugin tables) If not provided, uses ucfirst($entityName)

$data : iterable<string|int, mixed>|null = null

Optional pre-processed data. If provided, uses data mode instead of query mode. Data should be an iterable of entities or arrays with all computed fields populated.

Tags
throws
ForbiddenException

If user lacks export permission

Return values
Response

CSV download response

isCsvExportRequest()

Check if the current request is for CSV export

protected isCsvExportRequest() : bool
Return values
bool

True if CSV export is requested

isDataverseTableFrameRequest()

protected isDataverseTableFrameRequest() : bool
Return values
bool

Whether request is for inner table frame.

isGridOriginRequest()

Whether POST originated from a grid index (stay on list).

protected isGridOriginRequest(string|null $pageContextUrl) : bool
Parameters
$pageContextUrl : string|null
Return values
bool

loadAvailableViews()

Load and cache available views for the current request.

protected loadAvailableViews(string $gridKey, int $memberId) : array<int, mixed>
Parameters
$gridKey : string

Grid identifier

$memberId : int

Authenticated member id

Return values
array<int, mixed>

loadBestowalBulkTodoOptions()

Build per-row bulk completion options for open checks the current user may complete.

protected loadBestowalBulkTodoOptions(array<int, int> $bestowalIds) : array<int, string>
Parameters
$bestowalIds : array<int, int>

Displayed bestowal ids

Return values
array<int, string>

JSON-encoded option lists by bestowal id

loadBestowalTodoSummaries()

Batch-load preparation-check (to-do) action items for the given bestowal ids, grouped by bestowal id, ordered for checklist display.

protected loadBestowalTodoSummaries(array<int, int> $bestowalIds) : array<int, array<int, ActionItem>>
Parameters
$bestowalIds : array<int, int>

Displayed bestowal ids

Return values
array<int, array<int, ActionItem>>

loadFilterOptions()

Load filter options from a data source

protected loadFilterOptions(array<string|int, mixed>|string $source) : array<string|int, mixed>

Supports multiple formats for filterOptionsSource:

  1. Simple string (table name): Uses 'id' for value, 'name' for label

    'filterOptionsSource' => 'Branches'
    
  2. Array with table: Database table with full control

    'filterOptionsSource' => [
        'table' => 'Waivers.WaiverTypes',  // Required: table name for fetchTable()
        'valueField' => 'id',              // Optional: field for option value (default: 'id')
        'labelField' => 'name',            // Optional: field for option label (default: 'name')
        'conditions' => ['is_active' => true],  // Optional: filter conditions
        'order' => ['name' => 'ASC'],      // Optional: sort order (default: labelField ASC)
    ]
    
  3. Array with appSetting: Load from app settings (YAML array)

    'filterOptionsSource' => [
        'appSetting' => 'Branches.Types',  // Required: app setting key
    ]
    

    The app setting should contain a YAML array like: ['Kingdom', 'Principality', 'Barony'] Both value and label will be set to the array item value.

  4. Array with method: Call a static method on a class to get options

    'filterOptionsSource' => [
        'method' => 'getGatheringsFilterOptions',  // Required: static method name
        'class' => 'Awards\\KMP\\GridColumns\\RecommendationsGridColumns',  // Required: fully qualified class name
    ]
    

    The method should return array of ['value' => string, 'label' => string].

Parameters
$source : array<string|int, mixed>|string

Source identifier string (table name) or configuration array

Return values
array<string|int, mixed>

Filter options as array of ['value' => string, 'label' => string]

loadFilterOptionsCached()

Load filter options with per-request cache.

protected loadFilterOptionsCached(array<string|int, mixed>|string $source) : array<int, array{value: string, label: string}>
Parameters
$source : array<string|int, mixed>|string

filterOptionsSource configuration

Return values
array<int, array{value: string, label: string}>

matchesGridIndexPath()

Whether page context path matches a grid index route pattern.

protected matchesGridIndexPath(string|null $pageContextUrl, string $pathRegex) : bool
Parameters
$pageContextUrl : string|null
$pathRegex : string
Return values
bool

mobileQueuePagination()

Build shared pagination values for mobile actionable queues.

protected mobileQueuePagination(int $total) : array<string, int|bool>
Parameters
$total : int

Total actionable records

Return values
array<string, int|bool>

mobileQueuePaginationPayload()

Remove internal pagination values before sending the mobile JSON payload.

protected mobileQueuePaginationPayload(array<string, int|bool> $pagination) : array<string, int|bool>
Parameters
$pagination : array<string, int|bool>

Pagination data

Return values
array<string, int|bool>

operationCategorySummary()

Build a plain-text summary from trusted category labels and their counts.

protected operationCategorySummary(array<string, int> $categoryCounts, string $label) : string
Parameters
$categoryCounts : array<string, int>

Counts keyed by static, user-safe labels.

$label : string

User-facing summary label.

Return values
string

Empty when every count is zero.

operationReasonSummary()

Build a bounded, plain-text count of operational result reasons.

protected operationReasonSummary(array<string|int, mixed> $entries, string $label) : string
Parameters
$entries : array<string|int, mixed>

Result entries containing a reason.

$label : string

User-facing summary label.

Return values
string

Empty when no usable reasons were supplied.

organizeViewCells()

Organize view cells by type and display order.

protected organizeViewCells(array<string|int, mixed> $viewCells) : array<string|int, mixed>

Unused - view cells organized in ViewCellRegistry

Parameters
$viewCells : array<string|int, mixed>

Flat array of view cell configurations

Return values
array<string|int, mixed>

Organized array grouped by type and sorted by order

prepareBestowalsForDisplay()

Add computed display fields to bestowal entities in place.

protected prepareBestowalsForDisplay(iterable<string|int, Bestowal$bestowals[, array<int, string>|null $visibleColumns = null ][, bool $includeBulkTodoOptions = true ][, bool $forExport = false ]) : iterable<string|int, Bestowal>
Parameters
$bestowals : iterable<string|int, Bestowal>

Paginated bestowal entities

$visibleColumns : array<int, string>|null = null

Visible display columns, or null to prepare all

$includeBulkTodoOptions : bool = true

Whether to decorate rows with bulk to-do selection metadata.

$forExport : bool = false

Whether to use plain-text, spreadsheet-safe formatting.

Return values
iterable<string|int, Bestowal>

processDataverseGrid()

Process dataverse grid request with unified logic

protected processDataverseGrid(array<string|int, mixed> $config) : array<string|int, mixed>

This method handles all aspects of grid processing including view management, filtering, searching, sorting, and pagination. It supports both saved user views and system-defined views.

Parameters
$config : array<string|int, mixed>

Grid configuration with the following keys:

  • gridKey (string): Unique identifier for the grid
  • gridColumnsClass (string): Fully qualified class name for grid columns metadata
  • baseQuery (Query): Base query object to start with
  • tableName (string): Primary table name for field qualification
  • defaultSort (array): Default sort configuration ['field' => 'direction']
  • defaultPageSize (int): Default number of records per page (default: 25)
  • systemViews (array|null): Optional array of system views (for Warrants-style grids)
  • defaultSystemView (string|null): Default system view key (required if systemViews provided)
  • queryCallback (callable|null): Optional callback to modify query per system view
  • showAllTab (bool): Whether to show "All" tab (default: true for saved views, false for system views)
  • canAddViews (bool): Whether users can create custom views (default: true)
  • canFilter (bool): Whether user filtering is enabled (default: true). When false, users cannot add/remove filters via the UI or query parameters. However, filters defined by system views are ALWAYS applied regardless of this setting.
  • canExportCsv (bool): Whether CSV export button is shown (default: true)
  • showFilterPills (bool): Whether active filter pills/badges are displayed (default: true)
  • showViewTabs (bool): Whether view tabs are displayed (default: true)
  • enableColumnPicker (bool): Whether column picker is available (default: true)
  • lockedFilters (array): Array of filter column keys that cannot be removed by users. Locked filters will not show remove (×) buttons and their values cannot be cleared via query string parameters. Useful for embedded grids where context filters (e.g., member_id) must always be applied.
  • enableBulkSelection (bool): Whether row selection checkboxes are shown (default: false)
  • bulkSelection (array): Bulk selection accessibility label configuration. Keys: selectAllLabel, rowLabelTemplate, disabledLabel. rowLabelTemplate supports {field_key} placeholders resolved from each row, including dotted paths and column renderField aliases.
  • bulkActions (array): Array of bulk action button configurations when enableBulkSelection is true. Each action is an array with keys: label, icon, modalTarget, permission.
  • disablePagination (bool): When true, bypasses the paginator and returns all matching records. Use for views (e.g. calendar) that are already filtered to a bounded date range and must show every result without an arbitrary row cap. Caller responsibility*: the baseQuery MUST include WHERE clauses that bound the result set (e.g. a date range) to avoid fetching unbounded data. (default: false)

NOTE: Authorization scope must be applied to baseQuery BEFORE calling this method. Use $baseQuery = $this->Authorization->applyScope($baseQuery, 'index'); in your controller before passing the query to processDataverseGrid().

Return values
array<string|int, mixed>

Result array with keys: data, gridState, columnsMetadata, etc.

renderDataverseGridResponse()

Render consistent dataverse grid responses for outer/table turbo frames.

protected renderDataverseGridResponse(array<string, mixed> $result, string $frameId[, string|null $collectionVar = null ][, array<string, mixed> $extraViewVars = [] ]) : void
Parameters
$result : array<string, mixed>

processDataverseGrid() result

$frameId : string

Outer frame id (e.g. members-grid)

$collectionVar : string|null = null

Optional collection variable name to set (e.g. members)

$extraViewVars : array<string, mixed> = []

Additional vars to expose to template

renderDataverseTableRowElement()

Render a single Dataverse grid row element (Turbo Stream replace target HTML).

protected renderDataverseTableRowElement(array<string, mixed> $vars) : string
Parameters
$vars : array<string, mixed>

Element variables

Return values
string

renderTurboCloseModal()

Render turbo-stream: flash + replace table frame with lazy reload src.

protected renderTurboCloseModal(string $refreshFrame, array<string, mixed> $gridDataRoute[, string|null $pageContextUrl = null ][, array<string|int, mixed>|null $flashMessages = null ]) : Response
Parameters
$refreshFrame : string
$gridDataRoute : array<string, mixed>
$pageContextUrl : string|null = null
$flashMessages : array<string|int, mixed>|null = null
Return values
Response

renderTurboFlashOnly()

Render turbo-stream flash messages without forcing a grid or frame reload.

protected renderTurboFlashOnly([array<string|int, mixed>|null $flashMessages = null ]) : Response
Parameters
$flashMessages : array<string|int, mixed>|null = null
Return values
Response

renderTurboReloadFrame()

Stream that reloads an edit turbo-frame (validation errors).

protected renderTurboReloadFrame(string $frameId, string $frameSrc[, array<string|int, mixed>|null $flashMessages = null ]) : Response
Parameters
$frameId : string
$frameSrc : string
$flashMessages : array<string|int, mixed>|null = null
Return values
Response

renderTurboRemoveGridRow()

Render turbo-stream: flash + remove a grid row (no longer matches current filters).

protected renderTurboRemoveGridRow(string $rowDomId[, array<string|int, mixed>|null $flashMessages = null ]) : Response
Parameters
$rowDomId : string
$flashMessages : array<string|int, mixed>|null = null
Return values
Response

renderTurboReplaceGridRow()

Render turbo-stream: flash + replace a single grid row by DOM id.

protected renderTurboReplaceGridRow(string $rowDomId, string $rowHtml[, array<string|int, mixed>|null $flashMessages = null ]) : Response
Parameters
$rowDomId : string
$rowHtml : string
$flashMessages : array<string|int, mixed>|null = null
Return values
Response

resolveBranchIdFromContextMember()

Resolve a branch ID from member identifiers carried in workflow context.

protected resolveBranchIdFromContextMember(array<string, mixed> $context) : int|null

Supports both direct member IDs and member public IDs from public forms.

Parameters
$context : array<string, mixed>

Workflow trigger context.

Return values
int|null

resolveDataverseGridQueryContext()

Resolve Dataverse grid column context for early query construction.

protected resolveDataverseGridQueryContext(array<string, mixed> $config[, array<string, mixed>|null $selectedSystemView = null ][, mixed $currentView = null ][, bool $viewContextResolved = false ]) : DataverseGridQueryContext
Parameters
$config : array<string, mixed>

Grid configuration.

$selectedSystemView : array<string, mixed>|null = null

Already-resolved system view when called from processDataverseGrid().

$currentView : mixed = null

Already-resolved saved view when called from processDataverseGrid().

$viewContextResolved : bool = false

Whether null selected/current view values are already authoritative.

Return values
DataverseGridQueryContext

resolveKingdomId()

Resolve the kingdom ID from the authenticated member or workflow context.

protected resolveKingdomId([array<string, mixed> $context = [] ]) : int|null

Authenticated requests still prefer the actor's branch ancestry. Anonymous requests can derive kingdom from explicit branch or member identifiers in the workflow context so public forms can dispatch to kingdom-specific flows.

Parameters
$context : array<string, mixed> = []

Workflow trigger context.

Return values
int|null

Kingdom branch ID, or null if unavailable

resolveKingdomIdFromBranch()

Walk the branch parent chain to find the kingdom-type ancestor.

protected resolveKingdomIdFromBranch(int $branchId) : int|null
Parameters
$branchId : int

Starting branch ID

Return values
int|null

Kingdom branch ID, or null if no kingdom found

resolveNestedValue()

Resolve nested value from entity using dot notation path

protected resolveNestedValue(mixed $entity, string $path) : mixed
Parameters
$entity : mixed

Entity to traverse

$path : string

Dot-notation path (e.g., 'member.name_for_herald')

Return values
mixed

Resolved value or null if path doesn't exist

setGridViewVariables()

protected setGridViewVariables(iterable<string|int, Bestowal$bestowals, array<string, mixed> $result, string $frameId, string $tableFrameId) : void
Parameters
$bestowals : iterable<string|int, Bestowal>

Prepared bestowal entities

$result : array<string, mixed>

Grid result

$frameId : string

Outer turbo frame ID

$tableFrameId : string

Inner turbo frame ID

wantsTurboStreamRequest()

Whether the client expects a turbo-stream response.

protected wantsTurboStreamRequest() : bool
Return values
bool

withPageContextQuery()

Run a callback with query params from the posted page context URL.

protected withPageContextQuery(string|null $pageContextUrl, callable(): T $callback) : T
Parameters
$pageContextUrl : string|null
$callback : callable(): T
Tags
template
Return values
T

actionItemCascadeWarning()

Read a post-commit cascade warning from a successful to-do transition.

private actionItemCascadeWarning(ServiceResult $result) : string|null
Parameters
$result : ServiceResult

To-do transition result.

Return values
string|null

applyDataverseGridSort()

Apply a standard field sort or delegate to a column-specific sort handler.

private applyDataverseGridSort(SelectQuery $query, string $columnKey, string $direction, array<string, mixed> $columnMeta, string $tableName) : SelectQuery

Custom handlers are useful when a relation sort needs a correlated subquery or another expression that remains valid in paginator/eager-loader subqueries.

Parameters
$query : SelectQuery

Query being sorted.

$columnKey : string

Grid column key.

$direction : string

Requested sort direction.

$columnMeta : array<string, mixed>

Column metadata.

$tableName : string

Primary query alias.

Return values
SelectQuery

Sorted query.

buildTodoBlockedStatus()

Build per-item prerequisite display status for bestowal checklist surfaces.

private buildTodoBlockedStatus(iterable<string|int, ActionItem$todoItems, Bestowal $bestowal) : array<int, array<string, mixed>>
Parameters
$todoItems : iterable<string|int, ActionItem>

To-do items.

$bestowal : Bestowal

Bestowal owner.

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

buildTodoRequirementStatus()

Build per-item required-field display status for bestowal checklist surfaces.

private buildTodoRequirementStatus(iterable<string|int, ActionItem$todoItems, Bestowal $bestowal) : array<int, array<string, mixed>>
Parameters
$todoItems : iterable<string|int, ActionItem>

To-do items.

$bestowal : Bestowal

Bestowal owner.

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

bulkCascadeWarningSummary()

Build a warning suffix for committed checks with incomplete related cascades.

private bulkCascadeWarningSummary(int $warningCount, string|null $warningReason) : string
Parameters
$warningCount : int

Number of completed checks with cascade warnings.

$warningReason : string|null

First warning reason, when available.

Return values
string

bulkTodoOptionForItem()

private bulkTodoOptionForItem(ActionItem $item[, array<int, ActionItem$siblingItems = [] ]) : array<string, mixed>|null
Parameters
$item : ActionItem

Action item.

$siblingItems : array<int, ActionItem> = []

To-dos for the same bestowal.

Return values
array<string, mixed>|null

collectDataverseExpressionColumnKeys()

private collectDataverseExpressionColumnKeys(mixed $expression, array<int, string> &$columns) : void
Parameters
$expression : mixed
$columns : array<int, string>

columnKeyForDataverseField()

private columnKeyForDataverseField(string $field, array<string, array<string, mixed>> $columnsMetadata) : string
Parameters
$field : string
$columnsMetadata : array<string, array<string, mixed>>
Return values
string

dispatchBestowalMutation()

private dispatchBestowalMutation(TriggerDispatcher $triggerDispatcher, string $slug, string $triggerEvent, array<string, mixed> $context) : array{success: bool, data: array, error: ?string}
Parameters
$triggerDispatcher : TriggerDispatcher

Workflow dispatcher

$slug : string

Workflow definition slug

$triggerEvent : string

Workflow trigger event name

$context : array<string, mixed>

Workflow context

Return values
array{success: bool, data: array, error: ?string}

extractDataverseGridConfigColumnKeys()

private extractDataverseGridConfigColumnKeys(array<string, mixed> $config) : array<int, string>
Parameters
$config : array<string, mixed>
Return values
array<int, string>

filterRankedGatheringsByFlatList()

private filterRankedGatheringsByFlatList(array<int, array<string, mixed>> $rankedGatherings, array<int, string> $gatherings) : array<int, array<string, mixed>>
Parameters
$rankedGatherings : array<int, array<string, mixed>>

Grouped ranked options.

$gatherings : array<int, string>

Filtered flat option list keyed by gathering id.

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

findOpenGatheringRequiredTodoInItems()

Find the open gathering-required to-do for a bestowal.

private findOpenGatheringRequiredTodoInItems(array<int, ActionItem$items) : ActionItem|null
Parameters
$items : array<int, ActionItem>

Bestowal to-do items.

Return values
ActionItem|null

flashBulkGatheringSummary()

Flash a human-readable summary of a bulk gathering assignment.

private flashBulkGatheringSummary(int $updated, int $completed, int $unauthorized, int $invalid, int $notApplicable[, int $cascadeWarningCount = 0 ][, string|null $cascadeWarningReason = null ]) : void
Parameters
$updated : int

Bestowals updated

$completed : int

Required to-dos completed

$unauthorized : int

Unauthorized bestowals skipped

$invalid : int

Invalid/locked bestowals skipped

$notApplicable : int

Out-of-scope or no matching to-do rows

$cascadeWarningCount : int = 0

Completed checks whose related cascade needs attention.

$cascadeWarningReason : string|null = null

First cascade warning reason, when available.

flashBulkTodoSummary()

Flash a human-readable summary of a bulk check completion.

private flashBulkTodoSummary(int $completed, int $skipped, int $notApplicable[, string|null $failureReason = null ][, int $cascadeWarningCount = 0 ][, string|null $cascadeWarningReason = null ]) : void
Parameters
$completed : int

Items completed

$skipped : int

Items the actor was not eligible to complete

$notApplicable : int

Bestowals without the check open or out of scope

$failureReason : string|null = null

First completion failure reason, when available.

$cascadeWarningCount : int = 0

Completed checks whose related cascade needs attention.

$cascadeWarningReason : string|null = null

First cascade warning reason, when available.

isDataverseGridNumericSearchColumn()

private isDataverseGridNumericSearchColumn(array<string, mixed>|null $columnMeta) : bool
Parameters
$columnMeta : array<string, mixed>|null

Column metadata.

Return values
bool

isWorkflowDispatchResult()

private isWorkflowDispatchResult(array<int, mixed> $result) : bool
Parameters
$result : array<int, mixed>

Workflow dispatch results

Return values
bool

loadBestowalActionItems()

Batch-load to-do action items for selected bestowals.

private loadBestowalActionItems(array<int, int> $bestowalIds[, bool $openOnly = false ]) : array<int, array<int, ActionItem>>
Parameters
$bestowalIds : array<int, int>

Bestowal IDs.

$openOnly : bool = false

Whether to include only open items.

Return values
array<int, array<int, ActionItem>>

normalizeBestowalMutationResult()

private normalizeBestowalMutationResult(mixed $result) : array{success: bool, data: array, error: ?string}
Parameters
$result : mixed

Workflow dispatch result

Return values
array{success: bool, data: array, error: ?string}

normalizeDataverseGridColumnConfig()

private normalizeDataverseGridColumnConfig(mixed $columns) : array<int, string>
Parameters
$columns : mixed
Return values
array<int, string>

normalizeLockedDateBoundary()

Normalize a persisted date boundary while retaining an intentionally open bound.

private normalizeLockedDateBoundary(mixed $value) : string|null
Parameters
$value : mixed
Return values
string|null

pageContextQueryTab()

Tab query param from page context URL (detail pages).

private pageContextQueryTab(string|null $pageContextUrl) : string|null
Parameters
$pageContextUrl : string|null
Return values
string|null

parseBulkBestowalIds()

Normalize the bulk bestowal id payload (CSV string or array) to unique ints.

private parseBulkBestowalIds(mixed $raw) : array<int, int>
Parameters
$raw : mixed

The submitted bestowal_ids value

Return values
array<int, int>

positiveIntOrNull()

private positiveIntOrNull(mixed $value) : int|null
Parameters
$value : mixed

Raw value.

Return values
int|null

redirectAfterBestowalMutation()

Resolve the post-mutation redirect target consistently with the other bestowal mutation actions.

private redirectAfterBestowalMutation(string|null $pageContext, string|int|null $bestowalId) : Response|null
Parameters
$pageContext : string|null

Optional grid page-context URL.

$bestowalId : string|int|null

Bestowal id for the view fallback.

Return values
Response|null

resolveBestowalGridRowSync()

Resolve targeted row sync after a single bestowal save.

private resolveBestowalGridRowSync(int $bestowalId, string|null $pageContextUrl, BestowalQueryService $queryService) : array{action: string, rowDomId: string, rowHtml?: string}|null
Parameters
$bestowalId : int
$pageContextUrl : string|null
$queryService : BestowalQueryService
Return values
array{action: string, rowDomId: string, rowHtml?: string}|null

Null → full table refresh

resolveBestowalGridSyncContext()

private resolveBestowalGridSyncContext(string|null $pageContextUrl) : array{contextKey: string, tableFrameId: string, gatheringId?: int}|null
Parameters
$pageContextUrl : string|null
Return values
array{contextKey: string, tableFrameId: string, gatheringId?: int}|null

resolveDataverseGridActiveColumns()

Resolve hidden-but-active query dependency columns.

private resolveDataverseGridActiveColumns(array<string, mixed> $config, array<string, array<string, mixed>> $columnsMetadata, array<string, mixed>|null $selectedSystemView, mixed $currentView) : array<int, string>
Parameters
$config : array<string, mixed>

Grid configuration.

$columnsMetadata : array<string, array<string, mixed>>
$selectedSystemView : array<string, mixed>|null
$currentView : mixed
Return values
array<int, string>

resolveDataverseGridViewContext()

Resolve active saved/system view enough for pre-query column dependency planning.

private resolveDataverseGridViewContext(array<string, mixed> $config) : array{selectedSystemView: array|null, currentView: mixed}
Parameters
$config : array<string, mixed>

Grid configuration.

Return values
array{selectedSystemView: array|null, currentView: mixed}

resolveDataverseGridVisibleColumns()

Resolve UI-visible columns using the same precedence as processDataverseGrid().

private resolveDataverseGridVisibleColumns(class-string $gridColumnsClass, array<string, array<string, mixed>> $columnsMetadata, array<string, mixed>|null $selectedSystemView, mixed $currentView) : array<int, string>
Parameters
$gridColumnsClass : class-string
$columnsMetadata : array<string, array<string, mixed>>
$selectedSystemView : array<string, mixed>|null
$currentView : mixed
Return values
array<int, string>

shouldLoadBestowalDisplayColumn()

private shouldLoadBestowalDisplayColumn(string $columnKey, array<int, string>|null $visibleColumns) : bool
Parameters
$columnKey : string
$visibleColumns : array<int, string>|null
Return values
bool

tryBestowalsGridTurboResponse()

Turbo-stream response for grid-origin bestowal saves.

private tryBestowalsGridTurboResponse(string|null $pageContext, bool $success[, int|null $reloadEditId = null ][, int|null $updatedBestowalId = null ][, BestowalQueryService|null $queryService = null ]) : Response|null
Parameters
$pageContext : string|null
$success : bool
$reloadEditId : int|null = null
$updatedBestowalId : int|null = null
$queryService : BestowalQueryService|null = null
Return values
Response|null

withBestowalsBulkSelectionGridOptions()

Add the bestowals index bulk-selection contract to grid options.

private withBestowalsBulkSelectionGridOptions(array<string, mixed> $gridOptions) : array<string, mixed>
Parameters
$gridOptions : array<string, mixed>

Dataverse grid options.

Return values
array<string, mixed>
On this page

Search results