DefaultOfficerManager
in package
implements
OfficerManagerInterface
uses
QueuedMailerAwareTrait
Default implementation of OfficerManagerInterface for officer release management.
Handles workflow-shared officer release and recalculation operations with integrated warrant management and notification processing.
Tags
Table of Contents
Interfaces
- OfficerManagerInterface
- Service contract for shared officer release and recalculation operations.
Properties
- $mailer : Mailer
- $activeWindowManager : ActiveWindowManagerInterface
- $triggerDispatcher : TriggerDispatcher
- $warrantManager : WarrantManagerInterface
Methods
- __construct() : mixed
- recalculateOfficersForOffice() : ServiceResult
- Recalculate reporting relationships and roles for all current/upcoming officers of an office.
- release() : ServiceResult
- Release an officer from their position.
- queueMail() : Mailer
- Returns a mailer instance.
- queueMailJob() : void
- Queues a mail job to be processed later.
- sendMailNow() : Mailer
- Returns a mailer instance.
- _calculateOfficerReportingFields() : array<string|int, mixed>
- Calculate reporting relationship fields for an officer based on office configuration.
Properties
$mailer
protected
Mailer
$mailer
$activeWindowManager
private
ActiveWindowManagerInterface
$activeWindowManager
$triggerDispatcher
private
TriggerDispatcher
$triggerDispatcher
$warrantManager
private
WarrantManagerInterface
$warrantManager
Methods
__construct()
public
__construct(ActiveWindowManagerInterface $activeWindowManager, WarrantManagerInterface $warrantManager, TriggerDispatcher $triggerDispatcher) : mixed
Parameters
- $activeWindowManager : ActiveWindowManagerInterface
-
Temporal assignment management
- $warrantManager : WarrantManagerInterface
-
Warrant lifecycle coordination
- $triggerDispatcher : TriggerDispatcher
-
Workflow trigger dispatcher
recalculateOfficersForOffice()
Recalculate reporting relationships and roles for all current/upcoming officers of an office.
public
recalculateOfficersForOffice(int $officeId, int $updaterId) : ServiceResult
Call when office deputy_to_id, reports_to_id, or grants_role_id changes. Uses fail-fast error handling - stops on first failure.
Parameters
- $officeId : int
-
The office ID for officers requiring recalculation
- $updaterId : int
-
The updater ID for audit trail and role change tracking
Return values
ServiceResult —Result with updated_count, current_count, upcoming_count on success
release()
Release an officer from their position.
public
release(int $officerId, int $revokerId, DateTime $revokedOn, string|null $revokedReason[, string|null $releaseStatus = Officer::RELEASED_STATUS ]) : ServiceResult
Handles ActiveWindow termination, warrant cancellation for warrant-required offices, and sends release notification to the member.
Parameters
- $officerId : int
-
Officer identifier
- $revokerId : int
-
Administrator performing the release
- $revokedOn : DateTime
-
Effective release date
- $revokedReason : string|null
-
Optional reason for release
- $releaseStatus : string|null = Officer::RELEASED_STATUS
-
Status to set (defaults to RELEASED_STATUS)
Return values
ServiceResult —Success or failure with reason
queueMail()
Returns a mailer instance.
protected
queueMail(string $name, mixed $action, mixed $to, mixed $vars) : Mailer
Parameters
- $name : string
-
Mailer's name.
- $action : mixed
- $to : mixed
- $vars : mixed
Tags
Return values
MailerqueueMailJob()
Queues a mail job to be processed later.
protected
queueMailJob(array<string|int, mixed> $data) : void
Parameters
- $data : array<string|int, mixed>
-
Data to be passed to the mailer.
sendMailNow()
Returns a mailer instance.
protected
sendMailNow(array<string|int, mixed> $data) : Mailer
Parameters
- $data : array<string|int, mixed>
Tags
Return values
Mailer_calculateOfficerReportingFields()
Calculate reporting relationship fields for an officer based on office configuration.
private
_calculateOfficerReportingFields(object $office, object $officer) : array<string|int, mixed>
Parameters
- $office : object
-
The office entity with deputy_to_id, reports_to_id, and can_skip_report fields
- $officer : object
-
The officer entity with branch_id
Return values
array<string|int, mixed> —Associative array with reports_to_office_id, reports_to_branch_id, deputy_to_office_id, deputy_to_branch_id, deputy_description