TransitionContext
DTO (Data Transfer Object) con el contexto de una transición. Contiene toda la información necesaria para evaluar si una transición de estado es permitida, incluyendo actor, entidad, gates, evidencias y metadatos.
TransitionContext::__construct()
public function __construct(?int $actorId = null, ?string $actorRole = null, ?int $entityId = null, string $domain = 'opportunity', array $gatePassages = [], array $evidenceIds = [], array $fieldValues = [], ?string $reason = null, array $metadata = []):Parameters
| Name | Type | Description |
|---|---|---|
| $actorId | ?int | |
| $actorRole | ?string | |
| $entityId | ?int | |
| $domain | string | |
| $gatePassages | array | |
| $evidenceIds | array | |
| $fieldValues | array | |
| $reason | ?string | |
| $metadata | array |
TransitionContext::hasPassedGate()
public function hasPassedGate(int $gatePassageId): boolVerifica si un gate específico fue pasado previamente.
Parameters
| Name | Type | Description |
|---|---|---|
| $gatePassageId | int |
TransitionContext::hasEvidence()
public function hasEvidence(int $evidenceId): boolVerifica si una evidencia específica está presente.
Parameters
| Name | Type | Description |
|---|---|---|
| $evidenceId | int |
TransitionContext::hasFieldValue()
public function hasFieldValue(string $fieldName): boolVerifica si un campo tiene valor.
Parameters
| Name | Type | Description |
|---|---|---|
| $fieldName | string |
TransitionContext::getFieldValue()
public function getFieldValue(string $fieldName): ?mixedObtiene el valor de un campo o null si no existe.
Parameters
| Name | Type | Description |
|---|---|---|
| $fieldName | string |
TransitionContext::hasMetadata()
public function hasMetadata(string $key): boolVerifica si hay un metadato específico.
Parameters
| Name | Type | Description |
|---|---|---|
| $key | string |
TransitionContext::getMetadata()
public function getMetadata(string $key): ?mixedObtiene un metadato o null si no existe.
Parameters
| Name | Type | Description |
|---|---|---|
| $key | string |
TransitionContext::isGateWaived()
public function isGateWaived(string $gateCode): boolVerifica si el contexto indica que un gate fue exceptuado (waived).
Parameters
| Name | Type | Description |
|---|---|---|
| $gateCode | string |
TransitionContext::getWaiverJustification()
public function getWaiverJustification(): ?stringObtiene la justificación de un gate exceptuado, si existe.
TransitionContext::toArray()
public function toArray(): arrayConvierte el contexto a array para debugging o logging.