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
| Name | Type | Description |
|---|---|---|
| $em | Doctrine\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\GatePassageRequests 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
| Name | Type | Description |
|---|---|---|
| $gate | Milpa\Workflow\Entities\GateDefinition | |
| $entityType | string | |
| $entityId | int | |
| $requesterId | string | |
| $fieldValues | (array<string, mixed> | null) |
GatePassageService::approvePassage()
public function approvePassage(Milpa\Workflow\Entities\GatePassage $passage, string $approverId, ?string $notes = null): Milpa\Workflow\Entities\GatePassageApproves a pending gate passage and audits the approval.
Parameters
| Name | Type | Description |
|---|---|---|
| $passage | Milpa\Workflow\Entities\GatePassage | |
| $approverId | string | |
| $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\GatePassageRejects a pending gate passage with a reason and audits the rejection.
Parameters
| Name | Type | Description |
|---|---|---|
| $passage | Milpa\Workflow\Entities\GatePassage | |
| $rejectorId | string | |
| $reason | string |
GatePassageService::getApprovedPassagesForEntity()
public function getApprovedPassagesForEntity(string $entityType, int $entityId): arrayReturns every approved gate passage for the given polymorphic entity, most recent first.
Parameters
| Name | Type | Description |
|---|---|---|
| $entityType | string | |
| $entityId | int |
GatePassageService::waiveGate()
public function waiveGate(Milpa\Workflow\Entities\GateDefinition $gate, string $entityType, int $entityId, string $waiverId, string $justification): Milpa\Workflow\Entities\GatePassageApproves a gate passage without requiring its normal evidence/field requirements, recording the waiver and its justification, and audits it.
Parameters
| Name | Type | Description |
|---|---|---|
| $gate | Milpa\Workflow\Entities\GateDefinition | |
| $entityType | string | |
| $entityId | int | |
| $waiverId | string | |
| $justification | string |
Throws
NonWaivableGateException when the gate's `isWaivable` flag is false