have you ever had to handle a 'status' attribute in one of your model ?
And how many values this 'status' could have :2, 5, 42 ?
The Yii blog Demo application uses 3 statuses for its Post model : draft, ready, archived... Easy ! ... and moreover, any status can be reached from any other status (a draft can become archived, and archived can become ready, etc...) .. event easier !
But what if you have to handle a more complex workflow, with plenty of possible values for the 'status', and forbidden transitions between some statuses ? ..hummm .. not so easy !
The simpleWorkflow Extension can help ... well at least that's why it was written for.
It is simple to use :
- define your workflow
- associate your workflow with models
- add the simpleWorkflow behavior to models
- ...and that's it !
To know more about the simpleWorkflow Extension, you can check the documentation, API reference, and play with some demo pages.
The extension can be dowloaded from the Yii Extension section. A modified version of the Yii blog Demo is also available to demonstrate the extension usage.
Please note the current release is RC1.
Hopefully it will be useful to someone