raoul2000 / yii2-workflow

A simple workflow engine for Yii2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Event on enter workflow

ferllings opened this issue · comments

Hello,

I use SimpleWorkflowBehavior::EVENT_AFTER_CHANGE_STATUS
To trigger an action when my workflow status changes.

But this event is not triggered when my model enters the workflow using

$model->enterWorkflow();

Is there an event that I can use,like
afterEnterWorkflow{MyWorkflow}

Thanks

commented

Hi @ferllings ,
there is indeed an event fired when a model enter a workflow. The Event Model implemented by yii2-workflow is described here. You'll find events like :

  • beforeEnterWorkflow
  • beforeEnterStatus
  • afterEnterWorkflow
  • afterEnterStatus

Above events are fired when a model enters a workflow and so you could attach a handler to the ones that best fit your needs.
Cheers

Thanks,
It's working.

And it looks like I was wrong:
SimpleWorkflowBehavior::EVENT_AFTER_CHANGE_STATUS is also executed if you enter the workflow.