How symfony/workflow works
Main Components
a) Core Components:
• Workflow Engine (centered around Workflow.php and StateMachine.php)
• Definition Management (Definition.php, DefinitionBuilder.php)
• Marking System (Marking.php, MarkingStore/)
• Transition Management (Transition.php)
b) Supporting Systems:
• Event System (Event/ directory)
• Validation Layer (Validator/ directory)
• Debug & Monitoring (Debug/, DataCollector/)
• Visualization (Dumper/)
┌─ Application Layer ─────────────────────┐
• ┌─ Public API ─┐ │
• WorkflowInterface │
• Registry │ │
• ┘ │
• Core Layer ──────────────────────────┤
• ┌─ State Management ─┐ ┌─ Events ──┐ │
• Workflow │ │ Guards │ │
• StateMachine │ │ Listeners │ │
• Marking │ │ Dispatching│ │
• ┘ └───────────┘ │
• ┌─ Definition ──────┐ ┌─ Transition┐ │
• DefinitionBuilder │ │ Transition │ │
• Validation │ │ Blockers │ │
• ┘ └───────────┘ │
• Infrastructure Layer ─────────────────┤
• ┌─ Persistence ────┐ ┌─ Debug ────┐ │
• MarkingStore │ │ Collectors │ │
• MetadataStore │ │ Traceable │ │
• ┘ └───────────┘ │
• ┌─ Visualization ──┐ ┌─ DI ──────┐ │
• GraphvizDumper │ │ Compiler │ │
• MermaidDumper │ │ Passes │ │
• ┘ └───────────┘ │
• ┘
Key Relationships to Highlight
a) Primary Flows:
• WorkflowInterface → Workflow/StateMachine
• Workflow → Definition → Transitions
• Workflow → MarkingStore
• Workflow → EventDispatcher
b) Supporting Flows:
• Guards → Transitions
• Listeners → Events
• Dumpers → Definition
Implementation Details
• Use standardized UML notation where applicable
• Notes for important architectural decisions
• Relationship with Symfony's EventDispatcher component