raoul2000 / yii2-workflow

A simple workflow engine for Yii2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to manage multiple workflows for same model?

gb5256 opened this issue · comments

commented

Hi,
currently testing out your extension here, looks good so far.
One question:
We have two different workflows, lets say for BlogPost, which are totally independent.
Example:

  • PostWorkflowText
  • PostWorkflowImage

We were now thinking of moving the logic for this into a new model, lets say a table called 'Posts_Workflows'.
There we could store workflow_id, post_id and status as rows, allowing this to grow even to more that these two cases.

We have now attached your extension to this new model "Posts_Workflows", but of course we would need to define a default Workflow.
Is there a way that we can attach multiple workflows to the same model?
So we would like if a new Posts_Workflows record is created, we select which workflow to be used (we can handle that of course).
But if then a user wants to move forward with this record, the steps are depending on the workflow_id. So the attached behaviour would need to take the workflow_id from that model into account to read the right workflow definition file.

Any ideas if this is possible?
Would be great if you could direct us into the direction to take.
Thanks!

gb5256

commented

Hi,
and sorry for the late reply.. I thought an email would be sent when a new issue is created but obviously it's not the case (or I missed it). Anyway, is your question still relevant or did you find a way to achieve what you wanted to do ?

From what I understand you want to store the Post status value, not in a col of the Post table, but in, a row of the post_workflow table. Is it correct ?

I'm on holidays right now but if it still can be of any help, I'll try to answer when I'm back.
😎