Skip to content
docsv0.1.0

GatePassageService

Doctrine-backed {@see GateServiceInterface} implementation: persists append-only {@see \Milpa\Workflow\Entities\GatePassage} rows and enforces the anti-self-approval constraint (D9) at the service layer, since it is not expressible as a column constraint on an opaque principal string.

GatePassageService::__construct()

public function __construct(Doctrine\ORM\EntityManagerInterface $em, ?Milpa\Interfaces\Observability\AuditLoggerInterface $auditLogger = null):

Parameters

Parameters of __construct()
NameTypeDescription
$emDoctrine\ORM\EntityManagerInterface
$auditLogger?Milpa\Interfaces\Observability\AuditLoggerInterface

GatePassageService::requestPassage()

public function requestPassage(Milpa\Workflow\Entities\GateDefinition $gate, string $entityType, int $entityId, string $requesterId, ?array $fieldValues = null): Milpa\Workflow\Entities\GatePassage

Requests a new gate passage for the given gate and polymorphic entity, persisting it with {@see \Milpa\Workflow\Enums\GatePassageStatus::REQUESTED} and auditing the request.

Parameters

Parameters of requestPassage()
NameTypeDescription
$gateMilpa\Workflow\Entities\GateDefinition
$entityTypestring
$entityIdint
$requesterIdstring
$fieldValues(array<string, mixed> | null)

GatePassageService::approvePassage()

public function approvePassage(Milpa\Workflow\Entities\GatePassage $passage, string $approverId, ?string $notes = null): Milpa\Workflow\Entities\GatePassage

Approves a pending gate passage and audits the approval.

Parameters

Parameters of approvePassage()
NameTypeDescription
$passageMilpa\Workflow\Entities\GatePassage
$approverIdstring
$notes?string

Throws

SelfApprovalException when `$approverId` equals the passage's requester (D9)

GatePassageService::rejectPassage()

public function rejectPassage(Milpa\Workflow\Entities\GatePassage $passage, string $rejectorId, string $reason): Milpa\Workflow\Entities\GatePassage

Rejects a pending gate passage with a reason and audits the rejection.

Parameters

Parameters of rejectPassage()
NameTypeDescription
$passageMilpa\Workflow\Entities\GatePassage
$rejectorIdstring
$reasonstring

GatePassageService::getApprovedPassagesForEntity()

public function getApprovedPassagesForEntity(string $entityType, int $entityId): array

Returns every approved gate passage for the given polymorphic entity, most recent first.

Parameters

Parameters of getApprovedPassagesForEntity()
NameTypeDescription
$entityTypestring
$entityIdint

GatePassageService::waiveGate()

public function waiveGate(Milpa\Workflow\Entities\GateDefinition $gate, string $entityType, int $entityId, string $waiverId, string $justification): Milpa\Workflow\Entities\GatePassage

Approves a gate passage without requiring its normal evidence/field requirements, recording the waiver and its justification, and audits it.

Parameters

Parameters of waiveGate()
NameTypeDescription
$gateMilpa\Workflow\Entities\GateDefinition
$entityTypestring
$entityIdint
$waiverIdstring
$justificationstring

Throws

NonWaivableGateException when the gate's `isWaivable` flag is false