WarrantRoster
extends BaseEntity
in package
WarrantRoster Entity - Warrant Batch Management and Multi-Level Approval System
The WarrantRoster entity represents a batch container for warrant approval workflows within the KMP warrant system. This entity manages collections of warrants that require coordinated approval from multiple authorized signers, providing a structured approach to organizational warrant management and administrative oversight.
Core Architecture:
- Extends BaseEntity for KMP framework integration and branch authorization
- Implements batch management for multiple warrant approvals
- Provides multi-level authorization workflow with configurable approval requirements
- Integrates with warrant approval tracking system for administrative oversight
- Supports temporal validation with planned start and expiration dates
Batch Management System:
- Groups related warrants into manageable approval batches
- Provides centralized approval tracking and status management
- Enables bulk warrant operations for administrative efficiency
- Supports configurable approval requirements (approvals_required)
- Tracks current approval count for workflow status determination
Multi-Level Authorization:
- Configurable number of required approvals (approvals_required field)
- Real-time approval count tracking (approval_count field)
- Automatic status determination based on approval workflow state
- Integration with WarrantRosterApproval entities for detailed tracking
- Support for decline actions that immediately affect roster status
Status Management System:
- Pending: Awaiting required approvals (default state)
- Approved: All required approvals obtained (ready for warrant activation)
- Declined: At least one signer declined (workflow terminated)
- Automatic status calculation based on approval workflow progress
- Integration with warrant lifecycle for coordinated state management
Temporal Validation:
- planned_start_on: Planned warrant activation date for batch
- planned_expires_on: Planned warrant expiration date for batch
- Provides temporal boundaries for warrant batch lifecycle
- Enables administrative planning and coordination of warrant periods
- Supports organizational scheduling and resource management
Approval Workflow Integration:
- Links to WarrantRosterApproval entities for detailed approval tracking
- Supports multiple authorized signers with individual approval records
- Provides hasRequiredApprovals() method for workflow status checking
- Enables administrative oversight of approval progress
- Integrates with member authorization system for signer validation
Warrant Association:
- Serves as container for multiple Warrant entities
- Provides batch coordination for related warrant operations
- Enables bulk warrant processing and administrative efficiency
- Supports organizational warrant management workflows
- Links individual warrants to coordinated approval processes
Database Schema:
warrant_rosters:
id INT PRIMARY KEY AUTO_INCREMENT -- Unique roster identifier
name VARCHAR(255) NOT NULL -- Descriptive roster name
description TEXT -- Detailed roster description
approvals_required INT NOT NULL -- Number of required approvals
approval_count INT DEFAULT 0 -- Current approval count
status VARCHAR(20) DEFAULT 'Pending' -- Workflow status
planned_start_on DATETIME NOT NULL -- Planned activation date
planned_expires_on DATETIME NOT NULL -- Planned expiration date
created_by INT -- Creator member ID
created DATETIME NOT NULL -- Creation timestamp
modified DATETIME -- Last modification
modified_by INT -- Last modifier member ID
Usage Examples:
// Creating a warrant roster for batch approval
$warrantRoster = new WarrantRoster([
'name' => 'Q1 2024 Officer Warrants',
'description' => 'Quarterly warrant batch for new officers',
'approvals_required' => 3, // Requires 3 approvals
'planned_start_on' => '2024-01-01',
'planned_expires_on' => '2024-03-31'
]);
// Checking approval status
if ($warrantRoster->hasRequiredApprovals()) {
// Roster has sufficient approvals for warrant activation
$warrantRoster->status = WarrantRoster::STATUS_APPROVED;
}
// Status checking for workflow management
switch ($warrantRoster->status) {
case WarrantRoster::STATUS_PENDING:
// Continue approval workflow
break;
case WarrantRoster::STATUS_APPROVED:
// Activate associated warrants
break;
case WarrantRoster::STATUS_DECLINED:
// Handle declined roster
break;
}
Administrative Operations:
// Bulk warrant processing through roster
$rosterId = 123;
$warrantsTable = TableRegistry::getTableLocator()->get('Warrants');
$rosterWarrants = $warrantsTable->find()
->where(['warrant_roster_id' => $rosterId])
->contain(['Members', 'MemberRoles'])
->toArray();
// Approval workflow management
$approvalsTable = TableRegistry::getTableLocator()->get('WarrantRosterApprovals');
$pendingApprovals = $approvalsTable->find()
->where([
'warrant_roster_id' => $rosterId,
'approved' => null // Pending approvals
])
->contain(['Members'])
->toArray();
Integration Points:
- Warrants: Multiple warrants belong to a single roster
- WarrantRosterApprovals: Detailed approval tracking records
- Members: Creator and modifier tracking through audit trail
- Authorization System: Integration with KMP RBAC for signer validation
- Temporal System: Coordinate with warrant period management
Business Logic Considerations:
- Approval count must match or exceed approvals_required for approval
- Single decline action can terminate entire roster approval workflow
- Temporal boundaries guide warrant activation and expiration scheduling
- Administrative accountability through creator and modifier tracking
- Organizational workflow coordination through batch management
Security Features:
- Mass assignment protection for sensitive fields
- Integration with authorization system for signer validation
- Audit trail support through creation and modification tracking
- Organizational access control through KMP security framework
Tags
Table of Contents
Constants
- STATUS_APPROVED = 'Approved'
- STATUS_DECLINED = 'Declined'
- STATUS_PENDING = 'Pending'
Properties
- $approval_count : int|null
- $approvals_required : int
- $branch_id : int|null
- $created : DateTime
- $created_by : int|null
- $description : string
- $id : int
- $modified : DateTime|null
- $name : string
- $planned_expires_on : DateTime
- $planned_start_on : DateTime
- $warrant_roster_approvals : array<string|int, WarrantRosterApproval>
- $warrants : array<string|int, Warrant>
- $_accessible : array<string, bool>
- Mass Assignment Configuration - Security and Data Protection
Methods
- getBranchId() : int|null
- Get the branch ID for authorization checks.
- hasRequiredApprovals() : bool
- Check if roster has obtained required approvals for workflow completion
- _getCreatedByMemberScaName() : string|null
- Virtual property to get the created_by_member's SCA name for grid display
Constants
STATUS_APPROVED
public
string
STATUS_APPROVED
= 'Approved'
Roster approved - all required approvals obtained
STATUS_DECLINED
public
string
STATUS_DECLINED
= 'Declined'
Roster declined - at least one signer declined
STATUS_PENDING
public
string
STATUS_PENDING
= 'Pending'
Roster pending - awaiting required approvals (default state)
Properties
$approval_count
public
int|null
$approval_count
$approvals_required
public
int
$approvals_required
$branch_id
public
int|null
$branch_id
Associated branch ID (when applicable)
$created
public
DateTime
$created
$created_by
public
int|null
$created_by
$description
public
string
$description
$id
public
int
$id
$modified
public
DateTime|null
$modified
Last modification timestamp
$name
public
string
$name
$planned_expires_on
public
DateTime
$planned_expires_on
$planned_start_on
public
DateTime
$planned_start_on
$warrant_roster_approvals
public
array<string|int, WarrantRosterApproval>
$warrant_roster_approvals
$warrants
public
array<string|int, Warrant>
$warrants
$_accessible
Mass Assignment Configuration - Security and Data Protection
protected
array<string, bool>
$_accessible
= ['name' => true, 'description' => true, 'approvals_required' => true, 'approval_count' => true, 'created_by' => true, 'created' => true, 'warrant_roster_approvals' => true, 'warrants' => true]
Defines which fields can be safely mass assigned through newEntity() and patchEntity() operations. This configuration balances administrative efficiency with security requirements for warrant roster management operations.
Accessible Fields:
- name: Roster identification and description
- description: Detailed roster information
- approvals_required: Workflow configuration parameter
- approval_count: Current approval status tracking
- created_by: Administrative accountability tracking
- created: Timestamp management for audit trail
- warrant_roster_approvals: Associated approval records
- warrants: Associated warrant entities
Security Considerations:
- ID field protected from mass assignment for entity integrity
- Status field typically managed through workflow logic
- Temporal fields (planned_start_on, planned_expires_on) require explicit setting
- Administrative fields follow KMP security patterns
Administrative Usage:
- Enables efficient roster creation through form data
- Supports bulk operations while maintaining security
- Integrates with CakePHP entity security framework
- Follows KMP data protection standards
Methods
getBranchId()
Get the branch ID for authorization checks.
public
getBranchId() : int|null
Child classes should override for complex branch relationships.
Return values
int|null —The branch ID, or null if no association
hasRequiredApprovals()
Check if roster has obtained required approvals for workflow completion
public
hasRequiredApprovals() : bool
Evaluates whether the current approval count meets or exceeds the configured approval requirements for this warrant roster. This method provides the core business logic for determining when a roster approval workflow is complete and warrants can be activated.
Approval Logic:
- Compares current approval_count against approvals_required
- Returns true when sufficient approvals obtained
- Handles null approval_count as zero for safe comparison
- Provides foundation for status determination logic
Workflow Integration:
- Used by administrative interfaces for status display
- Integrates with warrant activation workflows
- Supports automated roster status updates
- Enables conditional logic for approval processing
Business Rules:
- Approval count must equal or exceed required approvals
- Single decline action can override approval status (handled separately)
- Zero approval_count treated as insufficient for workflow completion
- Administrative override capabilities through direct status management
Usage Examples:
// Check approval status for workflow decisions
if ($warrantRoster->hasRequiredApprovals()) {
// Proceed with warrant activation
$this->activateRosterWarrants($warrantRoster);
} else {
// Continue approval workflow
$this->requestAdditionalApprovals($warrantRoster);
}
// Administrative status management
$status = $warrantRoster->hasRequiredApprovals()
? WarrantRoster::STATUS_APPROVED
: WarrantRoster::STATUS_PENDING;
Integration Points:
- WarrantRosterApproval entities for detailed approval tracking
- Administrative interfaces for status display
- Warrant activation workflows for conditional processing
- Approval notification systems for workflow coordination
Return values
bool —True if approval count meets or exceeds requirements
_getCreatedByMemberScaName()
Virtual property to get the created_by_member's SCA name for grid display
protected
_getCreatedByMemberScaName() : string|null
Return values
string|null —The SCA name of the member who created this roster