RecommendationsTable
extends BaseTable
in package
Manages award recommendations with complex state machine and workflow management.
Handles complete recommendation lifecycle from submission through approval to presentation. Implements automated state logging via afterSave() hooks and supports both authenticated and guest recommendation workflows.
See /docs/5.2.4-awards-recommendations-table.md for complete documentation.
Tags
Table of Contents
Constants
- CACHE_GROUPS_TO_CLEAR = []
- CACHES_TO_CLEAR = []
- ID_CACHES_TO_CLEAR = []
Properties
- $AssignedEvent : EventsTable|BelongsTo
- $Awards : AwardsTable|BelongsTo
- $Branches : BranchesTable|BelongsTo
- $Events : EventsTable|BelongsToMany
- $Footprint : FootprintBehavior|Behavior
- $Members : MembersTable|BelongsTo
- $Notes : NotesTable|HasMany
- $RecommendationStateLogs : RecommendationsStatesLogsTable|HasMany
- $Requesters : MembersTable|BelongsTo
- $ScheduledEvent : EventsTable|BelongsTo
- $Sortable : SortableBehavior|Behavior
- $Timestamp : TimestampBehavior|Behavior
- $Trash : TrashBehavior|Behavior
Methods
- addBranchScopeQuery() : SelectQuery
- Apply branch-based filtering to a recommendations query.
- afterDelete() : void
- After delete hook to capture impersonation audit trail entries.
- afterSave() : void
- After save lifecycle hook for automated state change logging.
- beforeSave() : void
- Enforce recommendation workflow constraints before persisting changes.
- buildRules() : RulesChecker
- Business rules for referential integrity validation.
- deleteMany() : iterable<string|int, Recommendation>|ResultSetInterface<string|int, Recommendation>|false
- deleteManyOrFail() : iterable<string|int, Recommendation>|ResultSetInterface<string|int, Recommendation>
- findOrCreate() : Recommendation
- get() : Recommendation
- initialize() : void
- Configure the Recommendations table: table name, display/primary fields, behaviors, and associations.
- newEmptyEntity() : Recommendation
- newEntities() : array<string|int, Recommendation>
- newEntity() : Recommendation
- patchEntities() : array<string|int, Recommendation>
- patchEntity() : Recommendation
- save() : Recommendation|false
- saveMany() : iterable<string|int, Recommendation>|ResultSetInterface<string|int, Recommendation>|false
- saveManyOrFail() : iterable<string|int, Recommendation>|ResultSetInterface<string|int, Recommendation>
- saveOrFail() : Recommendation
- validationDefault() : Validator
- Default validation rules for recommendation data.
- logImpersonationAction() : void
- Record impersonated writes to audit log table.
- logStateChange() : void
- Create audit trail record for state transitions.
Constants
CACHE_GROUPS_TO_CLEAR
protected
array<string|int, string>
CACHE_GROUPS_TO_CLEAR
= []
Cache groups to clear entirely on save
CACHES_TO_CLEAR
protected
array<string|int, array{string, string}>
CACHES_TO_CLEAR
= []
Static cache entries to clear on save
ID_CACHES_TO_CLEAR
protected
array<string|int, array{string, string}>
ID_CACHES_TO_CLEAR
= []
Entity-ID cache prefixes to clear on save
Properties
$AssignedEvent
public
EventsTable|BelongsTo
$AssignedEvent
$Awards
public
AwardsTable|BelongsTo
$Awards
$Branches
public
BranchesTable|BelongsTo
$Branches
$Events
public
EventsTable|BelongsToMany
$Events
$Footprint
public
FootprintBehavior|Behavior
$Footprint
$Members
public
MembersTable|BelongsTo
$Members
$Notes
public
NotesTable|HasMany
$Notes
$RecommendationStateLogs
public
RecommendationsStatesLogsTable|HasMany
$RecommendationStateLogs
$Requesters
public
MembersTable|BelongsTo
$Requesters
$ScheduledEvent
public
EventsTable|BelongsTo
$ScheduledEvent
$Sortable
public
SortableBehavior|Behavior
$Sortable
$Timestamp
public
TimestampBehavior|Behavior
$Timestamp
$Trash
public
TrashBehavior|Behavior
$Trash
Methods
addBranchScopeQuery()
Apply branch-based filtering to a recommendations query.
public
addBranchScopeQuery(SelectQuery $query, array<string|int, int> $branchIDs) : SelectQuery
Filters the provided query so only records whose associated Awards.branch_id is contained in $branchIDs are returned. If $branchIDs is empty, the query is returned unchanged.
Parameters
- $query : SelectQuery
-
The query to modify.
- $branchIDs : array<string|int, int>
-
Array of branch IDs to restrict Awards.branch_id to.
Return values
SelectQuery —The query with branch filtering applied.
afterDelete()
After delete hook to capture impersonation audit trail entries.
public
afterDelete(EventInterface $event, EntityInterface $entity, ArrayObject $options) : void
Parameters
- $event : EventInterface
-
Delete event
- $entity : EntityInterface
-
Entity being deleted
- $options : ArrayObject
-
Delete options
afterSave()
After save lifecycle hook for automated state change logging.
public
afterSave(bool $created, EntityInterface $entity, ArrayObject $options) : void
Parameters
- $created : bool
-
Whether the entity was created (true) or updated (false)
- $entity : EntityInterface
-
The recommendation entity that was saved
- $options : ArrayObject
-
Save operation options and configuration
beforeSave()
Enforce recommendation workflow constraints before persisting changes.
public
beforeSave(EventInterface $event, EntityInterface $entity, ArrayObject $options) : void
Parameters
- $event : EventInterface
-
The beforeSave event.
- $entity : EntityInterface
-
The entity being persisted.
- $options : ArrayObject
-
Save operation options.
buildRules()
Business rules for referential integrity validation.
public
buildRules(RulesChecker $rules) : RulesChecker
Parameters
- $rules : RulesChecker
-
The rules object to be modified.
Return values
RulesCheckerdeleteMany()
public
deleteMany(iterable<string|int, mixed> $entities[, array<string|int, mixed> $options = = '[]' ]) : iterable<string|int, Recommendation>|ResultSetInterface<string|int, Recommendation>|false
Parameters
- $entities : iterable<string|int, mixed>
- $options : array<string|int, mixed> = = '[]'
Return values
iterable<string|int, Recommendation>|ResultSetInterface<string|int, Recommendation>|falsedeleteManyOrFail()
public
deleteManyOrFail(iterable<string|int, mixed> $entities[, array<string|int, mixed> $options = = '[]' ]) : iterable<string|int, Recommendation>|ResultSetInterface<string|int, Recommendation>
Parameters
- $entities : iterable<string|int, mixed>
- $options : array<string|int, mixed> = = '[]'
Return values
iterable<string|int, Recommendation>|ResultSetInterface<string|int, Recommendation>findOrCreate()
public
findOrCreate(mixed $search[, callable|null $callback = = 'null' ][, array<string|int, mixed> $options = = '[]' ]) : Recommendation
Parameters
- $search : mixed
- $callback : callable|null = = 'null'
- $options : array<string|int, mixed> = = '[]'
Return values
Recommendationget()
public
get(mixed $primaryKey[, array<string|int, mixed>|string $finder = = '\'all\'' ][, CacheInterface|string|null $cache = = 'null' ][, Closure|string|null $cacheKey = = 'null' ], mixed ...$args) : Recommendation
Parameters
- $primaryKey : mixed
- $finder : array<string|int, mixed>|string = = '\'all\''
- $cache : CacheInterface|string|null = = 'null'
- $cacheKey : Closure|string|null = = 'null'
- $args : mixed
Return values
Recommendationinitialize()
Configure the Recommendations table: table name, display/primary fields, behaviors, and associations.
public
initialize(array<string, mixed> $config) : void
Sets the database table and primary/display fields, attaches timestamp, footprint, trash, and sortable behaviors, and defines associations used for member links, awards, events/gatherings, notes, and state logs.
Parameters
- $config : array<string, mixed>
-
Table configuration options.
newEmptyEntity()
public
newEmptyEntity() : Recommendation
Return values
RecommendationnewEntities()
public
newEntities(array<string|int, mixed> $data[, array<string|int, mixed> $options = = '[]' ]) : array<string|int, Recommendation>
Parameters
- $data : array<string|int, mixed>
- $options : array<string|int, mixed> = = '[]'
Return values
array<string|int, Recommendation>newEntity()
public
newEntity(array<string|int, mixed> $data[, array<string|int, mixed> $options = = '[]' ]) : Recommendation
Parameters
- $data : array<string|int, mixed>
- $options : array<string|int, mixed> = = '[]'
Return values
RecommendationpatchEntities()
public
patchEntities(iterable<string|int, mixed> $entities, array<string|int, mixed> $data[, array<string|int, mixed> $options = = '[]' ]) : array<string|int, Recommendation>
Parameters
- $entities : iterable<string|int, mixed>
- $data : array<string|int, mixed>
- $options : array<string|int, mixed> = = '[]'
Return values
array<string|int, Recommendation>patchEntity()
public
patchEntity(EntityInterface $entity, array<string|int, mixed> $data[, array<string|int, mixed> $options = = '[]' ]) : Recommendation
Parameters
- $entity : EntityInterface
- $data : array<string|int, mixed>
- $options : array<string|int, mixed> = = '[]'
Return values
Recommendationsave()
public
save(EntityInterface $entity[, array<string|int, mixed> $options = = '[]' ]) : Recommendation|false
Parameters
- $entity : EntityInterface
- $options : array<string|int, mixed> = = '[]'
Return values
Recommendation|falsesaveMany()
public
saveMany(iterable<string|int, mixed> $entities[, array<string|int, mixed> $options = = '[]' ]) : iterable<string|int, Recommendation>|ResultSetInterface<string|int, Recommendation>|false
Parameters
- $entities : iterable<string|int, mixed>
- $options : array<string|int, mixed> = = '[]'
Return values
iterable<string|int, Recommendation>|ResultSetInterface<string|int, Recommendation>|falsesaveManyOrFail()
public
saveManyOrFail(iterable<string|int, mixed> $entities[, array<string|int, mixed> $options = = '[]' ]) : iterable<string|int, Recommendation>|ResultSetInterface<string|int, Recommendation>
Parameters
- $entities : iterable<string|int, mixed>
- $options : array<string|int, mixed> = = '[]'
Return values
iterable<string|int, Recommendation>|ResultSetInterface<string|int, Recommendation>saveOrFail()
public
saveOrFail(EntityInterface $entity[, array<string|int, mixed> $options = = '[]' ]) : Recommendation
Parameters
- $entity : EntityInterface
- $options : array<string|int, mixed> = = '[]'
Return values
RecommendationvalidationDefault()
Default validation rules for recommendation data.
public
validationDefault(Validator $validator) : Validator
Parameters
- $validator : Validator
-
Validator instance.
Return values
ValidatorlogImpersonationAction()
Record impersonated writes to audit log table.
protected
logImpersonationAction(string $defaultOperation, EntityInterface $entity) : void
Parameters
- $defaultOperation : string
-
Operation fallback (save/delete)
- $entity : EntityInterface
-
Affected entity
logStateChange()
Create audit trail record for state transitions.
protected
logStateChange(EntityInterface $entity) : void
Parameters
- $entity : EntityInterface
-
The recommendation entity with state changes