ActiveWindowManagerInterface
in
Active Window Manager Interface
Manages date-bounded entities (member roles, activities, authorizations) in the KMP system. Handles lifecycle of time periods where entities are considered "active" and effective.
Tags
Table of Contents
Methods
- start() : ServiceResult
- Start an active window for an entity.
- stop() : ServiceResult
- Stop an active window for an entity.
Methods
start()
Start an active window for an entity.
public
start(string $entityType, int $entityId, int $memberId, DateTime $startOn[, DateTime|null $expiresOn = null ][, int|null $termYears = null ][, int|null $grantRoleId = null ][, bool $closeExisting = true ][, int|null $branchId = null ]) : ServiceResult
Creates/activates a time-bounded entity. Handles overlapping windows if closeExisting=true. Caller MUST wrap in database transaction.
Parameters
- $entityType : string
-
Table name (e.g., 'MemberRoles', 'Activities')
- $entityId : int
-
Entity primary key ID
- $memberId : int
-
Member performing action (audit trail)
- $startOn : DateTime
-
When window should begin
- $expiresOn : DateTime|null = null
-
When window should end (null = no expiration)
- $termYears : int|null = null
-
Alternative: calculate end from term length
- $grantRoleId : int|null = null
-
Optional role to grant when window starts
- $closeExisting : bool = true
-
Auto-close overlapping existing windows
- $branchId : int|null = null
-
Branch context for role assignments
Return values
ServiceResult —Success/failure with details
stop()
Stop an active window for an entity.
public
stop(string $entityType, int $entityId, int $memberId, string $status, string $reason, DateTime $expiresOn) : ServiceResult
Terminates a window by setting expiration, status, and reason. Revokes any roles granted. Caller MUST wrap in database transaction.
Parameters
- $entityType : string
-
Table name of the entity type
- $entityId : int
-
Entity primary key ID
- $memberId : int
-
Member stopping window (audit trail)
- $status : string
-
Final status code (DEACTIVATED_STATUS, etc.)
- $reason : string
-
Explanation for stopping
- $expiresOn : DateTime
-
When window should terminate
Return values
ServiceResult —Success/failure with details