To use *SimpleWorkflowBehavior* with the default parameters, simply attach it to the model class like you would do
for any standard Yii2 behavior.
use raoul2000\workflow\base\SimpleWorkflowBehavior; public function behaviors() { return [ 'simpleWorkflow' => [ 'class' => SimpleWorkflowBehavior::className() ], ]; }To learn more about Yii2 behaviors refer to the Yii2 Definitive Guide You can customize the *SimpleWorkflowBehavior* with the following parameters : - statusAttribute : name of the attribute that is used by the owner model to hold the status value. The default value is "status". - defaultWorkflowId : identifier of the default workflow for the owner model. If no value is provided, the behavior creates a default workflow identifier (see [[getDefaultWorkflowId]]). - source : name of the *Workflow Source Component* that the behavior uses to read the workflow definition. By default the component id "workflowSource" is used. If it is not already available in the current application it is created by the behavior using the default workflow source component class. Below is an example behavior initialization :
use raoul2000\workflow\base\SimpleWorkflowBehavior; public function behaviors() { return [ 'simpleWorkflow' => [ 'class' => SimpleWorkflowBehavior::className(), 'statusAttribute' => 'col_status', 'defaultWorkflowId' => 'MyWorkflow', 'source' => 'myWorkflowSource', ], ]; }