KMP PHP API Reference

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
see
OfficerManagerInterface
https://github.com/Ansteorra/KMP/blob/main/docs/5.1.1-officers-services.md

for detailed documentation

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

Methods

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
throws
MissingMailerException

if undefined mailer class.

Return values
Mailer

queueMailJob()

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
throws
MissingMailerException

if undefined mailer class.

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

On this page

Search results