Workflow
- A user wants to sign up for a workshop/event
- Once registered, he needs to pay his ticket and is then approved for the workshop
- A confirmation mail is sent with details
Implementation
We "simulate" the payment gateway here, of course
- We have synchronous triggers (user on site sends registration form)
- There are also async triggers, e.g. status update from payment provider
- We also trigger async events and queue jobs, e.g. for sending emails
Let's try it
Graph
The following is a live graph of the workflow implementation (rendered fresh from config):
A real life example can often be 10-20x larger in complexity.
Code behind it
The state machine above is written in XML. It also shows the commands and conditions that directly link to PHP code.
For more technical details, follow the linked docs to the CakePHP plugin itself.