feat(blog): state machine vs workflow, with worked examples - #121
Merged
Conversation
Deep-dive companion to the existing short state-machine-vs-workflow guide, with four worked examples (order lifecycle, parallel fulfillment, article review, three concurrent lifecycles) and the two type-specific traps: `from: [a, b]` compiles to an OR under state_machine but an AND-join under workflow, and `to: [x, y]` fails StateMachineValidator at container compile time. Cross-links the older short post to the new one so the two do not compete on search. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a deep-dive companion to the existing short
state-machine-vs-workflowguide (2026-04-05), which stayed at the "one state vs many states" level.New post:
state-machine-vs-workflow-worked-examples— "State Machine vs Workflow: The Same Domain, Modeled Both Ways".What's in it
Four worked examples, each with YAML plus the PHP entity and call sites:
state_machine— string column,can()/apply()workflow— AND-split onpay, AND-join onship, JSON marking columnPlus the two traps, both checked against Symfony source rather than written from memory:
from: [a, b]is an OR understate_machineand an AND-join underworkflow, because FrameworkBundle expands state-machine transitions into oneTransitionper from×to pair while workflows keep a single multi-input transitionto: [x, y]understate_machinefails at container compile with the confusing "A transition from a place/state must have an unique name" message — a consequence of that same expansionCloses with a decision table, a 4-step state-machine → workflow migration checklist, and a simulator exercise.
Also
The older short post now links to this one at the end, so the two don't compete on search.
Notes
tsc --noEmitclean; lint-staged (eslint + prettier) ran on commitblogPosttable with the static array only as fallback, so this needspnpm prisma:seedagainst the target DB before it appears on the live site🤖 Generated with Claude Code